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