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 - (BOOL)isMainFrame;
210
211 - (void)appendChild:(WebCoreFrameBridge *)child;
212 - (void)removeChild:(WebCoreFrameBridge *)child;
213
214 - (unsigned)childCount;
215 - (BOOL)isDescendantOfFrame:(WebCoreFrameBridge *)ancestor;
216 - (WebCoreFrameBridge *)traverseNextFrameStayWithin:(WebCoreFrameBridge *)stayWithin;
217
218 - (WebCoreFrameBridge *)nextFrameWithWrap:(BOOL)wrap;
219 - (WebCoreFrameBridge *)previousFrameWithWrap:(BOOL)wrap;
220
221 - (WebCoreFrameBridge *)childFrameNamed:(NSString *)name;
222 - (WebCoreFrameBridge *)findFrameNamed:(NSString *)name;
223
224 - (void)provisionalLoadStarted;
225
226 - (void)openURL:(NSURL *)URL reload:(BOOL)reload
227     contentType:(NSString *)contentType refresh:(NSString *)refresh lastModified:(NSDate *)lastModified
228     pageCache:(NSDictionary *)pageCache;
229 - (void)setEncoding:(NSString *)encoding userChosen:(BOOL)userChosen;
230 - (void)addData:(NSData *)data;
231 - (void)closeURL;
232 - (void)stopLoading;
233
234 - (void)didNotOpenURL:(NSURL *)URL;
235 - (void)invalidatePageCache:(NSDictionary *)pageCache;
236
237 - (BOOL)canLoadURL:(NSURL *)URL fromReferrer:(NSString *)referrer hideReferrer:(BOOL *)hideReferrer;
238 - (BOOL)canTargetLoadInFrame:(WebCoreFrameBridge *)targetFrame;
239
240 - (void)saveDocumentState;
241 - (void)restoreDocumentState;
242
243 - (BOOL)canCachePage;
244 - (BOOL)saveDocumentToPageCache;
245
246 - (void)end;
247 - (void)stop;
248
249 - (void)clearFrame;
250 - (void)handleFallbackContent;
251
252 - (NSURL *)URL;
253 - (NSURL *)baseURL;
254 - (NSString *)referrer;
255 - (WebCoreFrameBridge *)opener;
256 - (void)setOpener:(WebCoreFrameBridge *)bridge;
257
258 - (void)installInFrame:(NSView *)view;
259 - (void)removeFromFrame;
260
261 - (void)scrollToAnchorWithURL:(NSURL *)URL;
262
263 - (BOOL)scrollOverflowInDirection:(WebScrollDirection)direction granularity:(WebScrollGranularity)granularity;
264
265 - (void)createFrameViewWithNSView:(NSView *)view marginWidth:(int)mw marginHeight:(int)mh;
266
267 - (BOOL)isFrameSet;
268
269 - (void)reapplyStylesForDeviceType:(WebCoreDeviceType)deviceType;
270 - (void)forceLayoutAdjustingViewSize:(BOOL)adjustSizeFlag;
271 - (void)forceLayoutWithMinimumPageWidth:(float)minPageWidth maximumPageWidth:(float)maxPageWidth adjustingViewSize:(BOOL)adjustSizeFlag;
272 - (void)sendResizeEvent;
273 - (void)sendScrollEvent;
274 - (BOOL)needsLayout;
275 - (void)setNeedsLayout;
276 - (void)drawRect:(NSRect)rect;
277 - (void)adjustPageHeightNew:(float *)newBottom top:(float)oldTop bottom:(float)oldBottom limit:(float)bottomLimit;
278 - (NSArray*)computePageRectsWithPrintWidthScaleFactor:(float)printWidthScaleFactor printHeight:(float)printHeight;
279
280 - (void)setActivationEventNumber:(int)num;
281 - (void)mouseDown:(NSEvent *)event;
282 - (void)mouseUp:(NSEvent *)event;
283 - (void)mouseMoved:(NSEvent *)event;
284 - (void)mouseDragged:(NSEvent *)event;
285
286 // these return YES if event is eaten by WebCore
287 - (BOOL)sendScrollWheelEvent:(NSEvent *)event;
288 - (BOOL)sendContextMenuEvent:(NSEvent *)event;
289
290 - (NSView *)nextKeyView;
291 - (NSView *)previousKeyView;
292
293 - (NSView *)nextKeyViewInsideWebFrameViews;
294 - (NSView *)previousKeyViewInsideWebFrameViews;
295
296 - (NSObject *)copyRenderTree:(id <WebCoreRenderTreeCopier>)copier;
297 - (NSString *)renderTreeAsExternalRepresentation;
298
299 - (void)getInnerNonSharedNode:(DOMNode **)innerNonSharedNode innerNode:(DOMNode **)innerNode URLElement:(DOMElement **)URLElement atPoint:(NSPoint)point allowShadowContent:(BOOL)allow;
300 - (BOOL)isPointInsideSelection:(NSPoint)point;
301
302 - (NSURL *)URLWithAttributeString:(NSString *)string;
303
304 - (DOMElement *)elementWithName:(NSString *)name inForm:(DOMElement *)form;
305 - (DOMElement *)elementForView:(NSView *)view;
306 - (BOOL)elementDoesAutoComplete:(DOMElement *)element;
307 - (BOOL)elementIsPassword:(DOMElement *)element;
308 - (DOMElement *)formForElement:(DOMElement *)element;
309 - (DOMElement *)currentForm;
310 - (NSArray *)controlsInForm:(DOMElement *)form;
311 - (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element;
312 - (NSString *)matchLabels:(NSArray *)labels againstElement:(DOMElement *)element;
313
314 - (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag;
315 - (unsigned)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag limit:(unsigned)limit;
316 - (BOOL)markedTextMatchesAreHighlighted;
317 - (void)setMarkedTextMatchesAreHighlighted:(BOOL)doHighlight;
318 - (void)unmarkAllTextMatches;
319 - (NSArray *)rectsForTextMatches;
320
321 - (NSString *)advanceToNextMisspelling;
322 - (NSString *)advanceToNextMisspellingStartingJustBeforeSelection;
323 - (void)unmarkAllMisspellings;
324
325 - (void)setTextSizeMultiplier:(float)multiplier;
326
327 - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)string;
328 - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)string forceUserGesture:(BOOL)forceUserGesture;
329 - (NSAppleEventDescriptor *)aeDescByEvaluatingJavaScriptFromString:(NSString *)string;
330
331 - (DOMDocument *)DOMDocument;
332 - (DOMHTMLElement *)frameElement;
333
334 - (BOOL)isSelectionInPasswordField;
335 - (BOOL)isSelectionEditable;
336 - (BOOL)isSelectionRichlyEditable;
337 - (WebSelectionState)selectionState;
338
339 - (BOOL)mayCopy;
340
341 - (NSAttributedString *)selectedAttributedString;
342 - (NSString *)selectedString;
343
344 - (void)setSelectionFromNone;
345 - (void)setIsActive:(BOOL)flag;
346
347 - (void)setWindowHasFocus:(BOOL)flag;
348
349 - (NSString *)stringForRange:(DOMRange *)range;
350
351 - (NSString *)markupStringFromNode:(DOMNode *)node nodes:(NSArray **)nodes;
352 - (NSString *)markupStringFromRange:(DOMRange *)range nodes:(NSArray **)nodes;
353
354 - (void)selectAll;
355 - (void)deselectAll;
356 - (void)deselectText;
357
358 - (NSRect)selectionRect;
359 - (NSRect)visibleSelectionRect;
360 - (void)centerSelectionInVisibleArea;
361 - (NSImage *)selectionImageForcingWhiteText:(BOOL)forceWhiteText;
362 - (NSRect)caretRectAtNode:(DOMNode *)node offset:(int)offset affinity:(NSSelectionAffinity)affinity;
363 - (NSRect)firstRectForDOMRange:(DOMRange *)range;
364 - (void)scrollDOMRangeToVisible:(DOMRange *)range;
365
366 - (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity closeTyping:(BOOL)closeTyping;
367 - (DOMRange *)selectedDOMRange;
368 - (NSSelectionAffinity)selectionAffinity;
369
370 // Emacs-style-editing "mark"
371 - (void)setMarkDOMRange:(DOMRange *)range;
372 - (DOMRange *)markDOMRange;
373
374 // international text input "marked text"
375 - (void)setMarkedTextDOMRange:(DOMRange *)range customAttributes:(NSArray *)attributes ranges:(NSArray *)ranges;
376 - (DOMRange *)markedTextDOMRange;
377 - (void)replaceMarkedTextWithText:(NSString *)text;
378
379 - (NSAttributedString *)attributedStringFrom:(DOMNode *)startNode startOffset:(int)startOffset to:(DOMNode *)endNode endOffset:(int)endOffset;
380
381 - (NSFont *)fontForSelection:(BOOL *)hasMultipleFonts;
382 - (NSDictionary *)fontAttributesForSelectionStart;
383 - (NSWritingDirection)baseWritingDirectionForSelectionStart;
384
385 - (NSString *)stringWithData:(NSData *)data; // using the encoding of the frame's main resource
386 + (NSString *)stringWithData:(NSData *)data textEncodingName:(NSString *)textEncodingName; // nil for textEncodingName means Latin-1
387
388 - (BOOL)interceptKeyEvent:(NSEvent *)event toView:(NSView *)view;
389
390 - (void)setShouldCreateRenderers:(BOOL)f;
391 - (BOOL)shouldCreateRenderers;
392
393 - (int)numPendingOrLoadingRequests;
394 - (BOOL)doneProcessingData;
395 - (BOOL)shouldClose;
396
397 - (void)setBaseBackgroundColor:(NSColor *)backgroundColor;
398 - (void)setDrawsBackground:(BOOL)drawsBackround;
399
400 - (NSColor *)bodyBackgroundColor;
401 - (NSColor *)selectionColor;
402
403 - (void)adjustViewSize;
404
405 - (id)accessibilityTree;
406
407 - (void)undoEditing:(id)arg;
408 - (void)redoEditing:(id)arg;
409
410 - (DOMRange *)rangeByExpandingSelectionWithGranularity:(WebBridgeSelectionGranularity)granularity;
411 - (DOMRange *)rangeOfCharactersAroundCaret;
412 - (DOMRange *)rangeByAlteringCurrentSelection:(WebSelectionAlteration)alteration direction:(WebBridgeSelectionDirection)direction granularity:(WebBridgeSelectionGranularity)granularity;
413 - (void)alterCurrentSelection:(WebSelectionAlteration)alteration direction:(WebBridgeSelectionDirection)direction granularity:(WebBridgeSelectionGranularity)granularity;
414 - (void)alterCurrentSelection:(WebSelectionAlteration)alteration verticalDistance:(float)distance;
415 - (WebBridgeSelectionGranularity)selectionGranularity;
416 - (DOMRange *)smartDeleteRangeForProposedRange:(DOMRange *)proposedCharRange;
417 - (void)smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)charRangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString;
418 - (BOOL)canDeleteRange:(DOMRange *)range;
419 - (void)selectNSRange:(NSRange)range;
420 - (NSRange)selectedNSRange;
421 - (NSRange)markedTextNSRange;
422 - (DOMRange *)convertNSRangeToDOMRange:(NSRange)range;
423 - (NSRange)convertDOMRangeToNSRange:(DOMRange *)range;
424
425 - (DOMDocumentFragment *)documentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString;
426 - (DOMDocumentFragment *)documentFragmentWithText:(NSString *)text inContext:(DOMRange *)context;
427 - (DOMDocumentFragment *)documentFragmentWithNodesAsParagraphs:(NSArray *)nodes;
428
429 - (void)replaceSelectionWithFragment:(DOMDocumentFragment *)fragment selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle;
430 - (void)replaceSelectionWithNode:(DOMNode *)node selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle;
431 - (void)replaceSelectionWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
432 - (void)replaceSelectionWithText:(NSString *)text selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
433
434 - (bool)canIncreaseSelectionListLevel;
435 - (bool)canDecreaseSelectionListLevel;
436 - (DOMNode *)increaseSelectionListLevel;
437 - (DOMNode *)increaseSelectionListLevelOrdered;
438 - (DOMNode *)increaseSelectionListLevelUnordered;
439 - (void)decreaseSelectionListLevel;
440
441 - (void)insertLineBreak;
442 - (void)insertParagraphSeparator;
443 - (void)insertParagraphSeparatorInQuotedContent;
444 - (void)insertText:(NSString *)text selectInsertedText:(BOOL)selectInsertedText;
445
446 - (void)setSelectionToDragCaret;
447 - (void)moveSelectionToDragCaret:(DOMDocumentFragment *)selectionFragment smartMove:(BOOL)smartMove;
448 - (void)moveDragCaretToPoint:(NSPoint)point;
449 - (void)removeDragCaret;
450 - (DOMRange *)dragCaretDOMRange;
451 - (BOOL)isDragCaretRichlyEditable;
452 - (DOMRange *)editableDOMRangeForPoint:(NSPoint)point;
453 - (DOMRange *)characterRangeAtPoint:(NSPoint)point;
454
455 - (void)deleteSelectionWithSmartDelete:(BOOL)smartDelete;
456 - (void)deleteKeyPressedWithSmartDelete:(BOOL)smartDelete granularity:(WebBridgeSelectionGranularity)granularity;
457 - (void)forwardDeleteKeyPressedWithSmartDelete:(BOOL)smartDelete granularity:(WebBridgeSelectionGranularity)granularity;
458
459 - (DOMCSSStyleDeclaration *)typingStyle;
460 - (void)setTypingStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebUndoAction)undoAction;
461 - (void)applyStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebUndoAction)undoAction;
462 - (void)applyParagraphStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebUndoAction)undoAction;
463 - (BOOL)selectionStartHasStyle:(DOMCSSStyleDeclaration *)style;
464 - (NSCellStateValue)selectionHasStyle:(DOMCSSStyleDeclaration *)style;
465 - (void)applyEditingStyleToBodyElement;
466 - (void)removeEditingStyleFromBodyElement;
467 - (void)applyEditingStyleToElement:(DOMElement *)element;
468 - (void)removeEditingStyleFromElement:(DOMElement *)element;
469
470 - (WebScriptObject *)windowScriptObject;
471 - (NPObject *)windowScriptNPObject;
472
473 - (BOOL)eventMayStartDrag:(NSEvent *)event;
474 - (NSDragOperation)dragOperationForDraggingInfo:(id <NSDraggingInfo>)info;
475 - (void)dragExitedWithDraggingInfo:(id <NSDraggingInfo>)info;
476 - (BOOL)concludeDragForDraggingInfo:(id <NSDraggingInfo>)info;
477 - (void)dragSourceMovedTo:(NSPoint)windowLoc;
478 - (void)dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation;
479
480 - (BOOL)mayDHTMLCut;
481 - (BOOL)mayDHTMLCopy;
482 - (BOOL)mayDHTMLPaste;
483 - (BOOL)tryDHTMLCut;
484 - (BOOL)tryDHTMLCopy;
485 - (BOOL)tryDHTMLPaste;
486
487 - (NSMutableDictionary *)dashboardRegions;
488
489 - (void)clear;
490
491 - (BOOL)isCharacterSmartReplaceExempt:(unichar)c isPreviousCharacter:(BOOL)isPreviousCharacter;
492
493 - (BOOL)getData:(NSData **)data andResponse:(NSURLResponse **)response forURL:(NSURL *)URL;
494 - (void)getAllResourceDatas:(NSArray **)datas andResponses:(NSArray **)responses;
495
496 - (BOOL)canProvideDocumentSource;
497 - (BOOL)canSaveAsWebArchive;
498 - (BOOL)containsPlugins;
499
500 - (void)setInViewSourceMode:(BOOL)flag;
501 - (BOOL)inViewSourceMode;
502
503 - (void)setProhibitsScrolling:(BOOL)prohibits;
504
505 @end
506
507 // The WebCoreFrameBridge protocol contains methods for use by the WebCore side of the bridge.
508
509 // In NSArray objects for post data, NSData objects represent literal data, and NSString objects represent encoded files.
510 // The encoding is the standard form encoding for uploading files.
511
512 @class WebFrameLoader;
513
514 @protocol WebCoreFrameBridge
515
516 - (WebFrameLoader *)frameLoader;
517
518 - (void)frameDetached;
519 - (NSView *)documentView;
520
521 - (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;
522 - (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;
523
524 - (WebCorePageBridge *)createWindowWithURL:(NSURL *)URL;
525 - (void)showWindow;
526
527 - (BOOL)canRunModal;
528 - (BOOL)canRunModalNow;
529 - (WebCorePageBridge *)createModalDialogWithURL:(NSURL *)URL;
530 - (void)runModal;
531
532 - (NSString *)userAgentForURL:(NSURL *)URL;
533
534 - (void)setTitle:(NSString *)title;
535 - (void)setStatusText:(NSString *)status;
536
537 - (WebCoreFrameBridge *)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL
538     referrer:(NSString *)referrer
539     ownerElement:(WebCoreElement *)ownerElement
540     allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height;
541
542 - (BOOL)areToolbarsVisible;
543 - (void)setToolbarsVisible:(BOOL)visible;
544 - (BOOL)isStatusbarVisible;
545 - (void)setStatusbarVisible:(BOOL)visible;
546 - (BOOL)areScrollbarsVisible;
547 - (void)setScrollbarsVisible:(BOOL)visible;
548 - (NSWindow *)window;
549
550 - (void)setWindowIsResizable:(BOOL)resizable;
551 - (BOOL)windowIsResizable;
552
553 - (NSResponder *)firstResponder;
554 - (void)makeFirstResponder:(NSResponder *)responder;
555 - (void)willMakeFirstResponderForNodeFocus;
556
557 - (BOOL)textViewWasFirstResponderAtMouseDownTime:(NSTextView *)textView;
558
559 - (void)closeWindowSoon;
560
561 - (void)runJavaScriptAlertPanelWithMessage:(NSString *)message;
562 - (BOOL)runJavaScriptConfirmPanelWithMessage:(NSString *)message;
563 - (BOOL)runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText returningText:(NSString **)result;
564 - (BOOL)shouldInterruptJavaScript;
565 - (BOOL)canRunBeforeUnloadConfirmPanel;
566 - (BOOL)runBeforeUnloadConfirmPanelWithMessage:(NSString *)message;
567 - (void)addMessageToConsole:(NSDictionary *)message;
568 - (void)runOpenPanelForFileButtonWithResultListener:(id <WebCoreOpenPanelResultListener>)resultListener;
569
570 - (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withMethod:(NSString *)method URL:(NSURL *)URL customHeaders:(NSDictionary *)customHeaders;
571 - (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withMethod:(NSString *)method URL:(NSURL *)URL customHeaders:(NSDictionary *)customHeaders postData:(NSArray *)data;
572 - (void)objectLoadedFromCacheWithURL:(NSURL *)URL response:(NSURLResponse *)response data:(NSData *)data;
573
574 - (NSData *)syncLoadResourceWithMethod:(NSString *)method URL:(NSURL *)URL customHeaders:(NSDictionary *)requestHeaders postData:(NSArray *)postData finalURL:(NSURL **)finalNSURL responseHeaders:(NSDictionary **)responseHeaderDict statusCode:(int *)statusCode;
575
576 - (BOOL)isReloading;
577 - (time_t)expiresTimeForResponse:(NSURLResponse *)response;
578
579 - (void)reportClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date lockHistory:(BOOL)lockHistory isJavaScriptFormAction:(BOOL)isJavaScriptFormAction;
580 - (void)reportClientRedirectCancelled:(BOOL)cancelWithLoadInProgress;
581
582 - (void)activateWindow;
583 - (void)deactivateWindow;
584
585 - (void)formControlIsBecomingFirstResponder:(NSView *)formControl;
586 - (void)formControlIsResigningFirstResponder:(NSView *)formControl;
587
588 - (NSView *)nextKeyViewOutsideWebFrameViews;
589 - (NSView *)nextValidKeyViewOutsideWebFrameViews;
590 - (NSView *)previousKeyViewOutsideWebFrameViews;
591
592 - (BOOL)defersLoading;
593 - (void)setDefersLoading:(BOOL)loading;
594 - (void)saveDocumentState:(NSArray *)documentState;
595 - (NSArray *)documentState;
596
597 - (void)setNeedsReapplyStyles;
598
599 - (void)tokenizerProcessedData;
600
601 - (NSString *)incomingReferrer;
602
603 - (NSView *)viewForPluginWithURL:(NSURL *)URL
604                   attributeNames:(NSArray *)attributeNames
605                  attributeValues:(NSArray *)attributeValues
606                         MIMEType:(NSString *)MIMEType
607                       DOMElement:(DOMElement *)element
608                     loadManually:(BOOL)loadManually;
609 - (NSView *)viewForJavaAppletWithFrame:(NSRect)frame
610                         attributeNames:(NSArray *)attributeNames
611                        attributeValues:(NSArray *)attributeValues
612                                baseURL:(NSURL *)baseURL
613                             DOMElement:(DOMElement *)element;
614 - (void)redirectDataToPlugin:(NSView *)pluginView;
615
616 - (BOOL)saveDocumentToPageCache:(id)documentInfo;
617
618 - (int)getObjectCacheSize;
619
620 - (ObjectElementType)determineObjectFromMIMEType:(NSString*)MIMEType URL:(NSURL*)URL;
621
622 - (void)loadEmptyDocumentSynchronously;
623
624 - (NSString *)MIMETypeForPath:(NSString *)path;
625
626 - (void)allowDHTMLDrag:(BOOL *)flagDHTML UADrag:(BOOL *)flagUA;
627 - (BOOL)startDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc operation:(NSDragOperation)op event:(NSEvent *)event sourceIsDHTML:(BOOL)flag DHTMLWroteData:(BOOL)dhtmlWroteData;
628 - (BOOL)mayStartDragAtEventLocation:(NSPoint)location;
629
630 - (BOOL)selectWordBeforeMenuEvent;
631
632 - (int)historyLength;
633 - (void)goBackOrForward:(int)distance;
634 - (BOOL)canGoBackOrForward:(int)distance;
635 - (NSURL *)historyURL:(int)distance;
636
637 - (void)textFieldDidBeginEditing:(DOMHTMLInputElement *)element;
638 - (void)textFieldDidEndEditing:(DOMHTMLInputElement *)element;
639 - (void)textDidChangeInTextField:(DOMHTMLInputElement *)element;
640 - (void)textDidChangeInTextArea:(DOMHTMLTextAreaElement *)element;
641
642 - (BOOL)textField:(DOMHTMLInputElement *)element doCommandBySelector:(SEL)commandSelector;
643 - (BOOL)textField:(DOMHTMLInputElement *)element shouldHandleEvent:(NSEvent *)event;
644
645 - (void)setHasBorder:(BOOL)hasBorder;
646
647 - (NSFileWrapper *)fileWrapperForURL:(NSURL *)URL;
648
649 - (void)print;
650
651 - (jobject)getAppletInView:(NSView *)view;
652
653 // Deprecated, use getAppletInView: instead.
654 - (jobject)pollForAppletInView:(NSView *)view;
655
656 - (NSUndoManager *)undoManager;
657 - (NSString *)nameForUndoAction:(WebUndoAction)undoAction;
658 - (void)issueCutCommand;
659 - (void)issueCopyCommand;
660 - (void)issuePasteCommand;
661 - (void)issuePasteAndMatchStyleCommand;
662 - (void)issueTransposeCommand;
663 - (void)respondToChangedSelection;
664 - (void)respondToChangedContents;
665 - (void)setIsSelected:(BOOL)isSelected forView:(NSView *)view;
666 - (BOOL)isEditable;
667 - (BOOL)shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag;
668 - (BOOL)shouldDeleteSelectedDOMRange:(DOMRange *)currentRange;
669 - (BOOL)shouldBeginEditing:(DOMRange *)range;
670 - (BOOL)shouldEndEditing:(DOMRange *)range;
671 - (void)didBeginEditing;
672 - (void)didEndEditing;
673 - (BOOL)canPaste;
674
675 - (NSString *)overrideMediaType;
676
677 - (void)windowObjectCleared;
678
679 - (int)spellCheckerDocumentTag;
680 - (BOOL)isContinuousSpellCheckingEnabled;
681
682 - (void)didFirstLayout;
683
684 - (void)dashboardRegionsChanged:(NSMutableDictionary *)regions;
685
686 - (NSRect)customHighlightRect:(NSString*)type forLine:(NSRect)lineRect;
687 - (void)paintCustomHighlight:(NSString*)type forBox:(NSRect)boxRect onLine:(NSRect)lineRect behindText:(BOOL)text entireLine:(BOOL)line;
688
689 - (void)handledOnloadEvents;
690
691 - (WebCoreKeyboardUIMode)keyboardUIMode;
692
693 - (NSURLResponse*)mainResourceURLResponse;
694 - (NSString*)imageTitleForFilename:(NSString*)filename size:(NSSize)size;
695
696 - (void)notifyIconChanged:(NSURL*)iconURL;
697 - (NSURL*)originalRequestURL;
698 - (BOOL)isLoadTypeReload;
699 @end
700
701 // This interface definition allows those who hold a WebCoreFrameBridge * to call all the methods
702 // in the WebCoreFrameBridge protocol without requiring the base implementation to supply the methods.
703 // This idiom is appropriate because WebCoreFrameBridge is an abstract class.
704
705 @interface WebCoreFrameBridge (SubclassResponsibility) <WebCoreFrameBridge>
706 @end
707
708 // One method for internal use within WebCore itself.
709 // Could move this to another header, but would be a pity to create an entire header just for that.
710
711 @interface WebCoreFrameBridge (WebCoreInternalUse)
712 - (WebCoreMacFrame*)impl;
713 @end
714
715 // Protocols that make up part of the interaces above.
716
717 @protocol WebCoreRenderTreeCopier <NSObject>
718 - (NSObject *)nodeWithName:(NSString *)name position:(NSPoint)p rect:(NSRect)rect view:(NSView *)view children:(NSArray *)children;
719 @end
720