• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2005, 2006, 2007, 2008 Apple 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  *
8  * 1.  Redistributions of source code must retain the above copyright
9  *     notice, this list of conditions and the following disclaimer.
10  * 2.  Redistributions in binary form must reproduce the above copyright
11  *     notice, this list of conditions and the following disclaimer in the
12  *     documentation and/or other materials provided with the distribution.
13  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14  *     its contributors may be used to endorse or promote products derived
15  *     from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 // This header contains WebFrame declarations that can be used anywhere in WebKit, but are neither SPI nor API.
30 
31 #import "WebFramePrivate.h"
32 #import "WebPreferencesPrivate.h"
33 
34 #import <WebCore/EditAction.h>
35 #import <WebCore/FrameLoaderTypes.h>
36 #import <WebCore/SelectionController.h>
37 #import <WebCore/Settings.h>
38 
39 @class DOMCSSStyleDeclaration;
40 @class DOMDocumentFragment;
41 @class DOMElement;
42 @class DOMNode;
43 @class DOMRange;
44 @class WebFrameView;
45 @class WebHistoryItem;
46 
47 class WebScriptDebugger;
48 
49 namespace WebCore {
50     class CSSStyleDeclaration;
51     class Document;
52     class DocumentLoader;
53     class Element;
54     class Frame;
55     class Frame;
56     class HistoryItem;
57     class HTMLElement;
58     class HTMLFrameOwnerElement;
59     class Node;
60     class Page;
61     class Range;
62 }
63 
64 typedef WebCore::HistoryItem WebCoreHistoryItem;
65 
66 WebCore::Frame* core(WebFrame *);
67 WebFrame *kit(WebCore::Frame *);
68 
69 WebCore::Page* core(WebView *);
70 WebView *kit(WebCore::Page*);
71 
72 WebCore::EditableLinkBehavior core(WebKitEditableLinkBehavior);
73 WebCore::TextDirectionSubmenuInclusionBehavior core(WebTextDirectionSubmenuInclusionBehavior);
74 
75 WebView *getWebView(WebFrame *webFrame);
76 
77 @interface WebFramePrivate : NSObject {
78 @public
79     WebCore::Frame* coreFrame;
80     WebFrameView *webFrameView;
81     WebScriptDebugger* scriptDebugger;
82     id internalLoadDelegate;
83     BOOL shouldCreateRenderers;
84 }
85 @end
86 
87 @protocol WebCoreRenderTreeCopier <NSObject>
88 - (NSObject *)nodeWithName:(NSString *)name position:(NSPoint)position rect:(NSRect)rect view:(NSView *)view children:(NSArray *)children;
89 @end
90 
91 @interface WebFrame (WebInternal)
92 
93 + (void)_createMainFrameWithPage:(WebCore::Page*)page frameName:(const WebCore::String&)name frameView:(WebFrameView *)frameView;
94 + (PassRefPtr<WebCore::Frame>)_createSubframeWithOwnerElement:(WebCore::HTMLFrameOwnerElement*)ownerElement frameName:(const WebCore::String&)name frameView:(WebFrameView *)frameView;
95 - (id)_initWithWebFrameView:(WebFrameView *)webFrameView webView:(WebView *)webView;
96 
97 - (void)_clearCoreFrame;
98 
99 - (void)_updateBackgroundAndUpdatesWhileOffscreen;
100 - (void)_setInternalLoadDelegate:(id)internalLoadDelegate;
101 - (id)_internalLoadDelegate;
102 #ifndef BUILDING_ON_TIGER
103 - (void)_unmarkAllBadGrammar;
104 #endif
105 - (void)_unmarkAllMisspellings;
106 
107 - (BOOL)_hasSelection;
108 - (void)_clearSelection;
109 - (WebFrame *)_findFrameWithSelection;
110 - (void)_clearSelectionInOtherFrames;
111 
112 - (void)_attachScriptDebugger;
113 - (void)_detachScriptDebugger;
114 
115 // dataSource reports null for the initial empty document's data source; this is needed
116 // to preserve compatibility with Mail and Safari among others. But internal to WebKit,
117 // we need to be able to get the initial data source as well, so the _dataSource method
118 // should be used instead.
119 - (WebDataSource *)_dataSource;
120 
121 - (BOOL)_needsLayout;
122 - (void)_drawRect:(NSRect)rect contentsOnly:(BOOL)contentsOnly;
123 - (BOOL)_getVisibleRect:(NSRect*)rect;
124 - (NSArray*)_computePageRectsWithPrintWidthScaleFactor:(float)printWidthScaleFactor printHeight:(float)printHeight;
125 
126 - (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string;
127 - (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string forceUserGesture:(BOOL)forceUserGesture;
128 
129 - (NSString *)_selectedString;
130 - (NSString *)_stringForRange:(DOMRange *)range;
131 
132 - (NSString *)_markupStringFromRange:(DOMRange *)range nodes:(NSArray **)nodes;
133 
134 - (NSRect)_caretRectAtNode:(DOMNode *)node offset:(int)offset affinity:(NSSelectionAffinity)affinity;
135 - (NSRect)_firstRectForDOMRange:(DOMRange *)range;
136 - (void)_scrollDOMRangeToVisible:(DOMRange *)range;
137 
138 - (id)_accessibilityTree;
139 
140 - (DOMRange *)_rangeByAlteringCurrentSelection:(WebCore::SelectionController::EAlteration)alteration direction:(WebCore::SelectionController::EDirection)direction granularity:(WebCore::TextGranularity)granularity;
141 - (void)_smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)charRangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString;
142 - (NSRange)_convertToNSRange:(WebCore::Range*)range;
143 - (DOMRange *)_convertNSRangeToDOMRange:(NSRange)range;
144 - (NSRange)_convertDOMRangeToNSRange:(DOMRange *)range;
145 
146 - (DOMDocumentFragment *)_documentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString;
147 - (DOMDocumentFragment *)_documentFragmentWithNodesAsParagraphs:(NSArray *)nodes;
148 
149 - (void)_replaceSelectionWithNode:(DOMNode *)node selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle;
150 
151 - (void)_insertParagraphSeparatorInQuotedContent;
152 
153 - (DOMRange *)_characterRangeAtPoint:(NSPoint)point;
154 
155 - (DOMCSSStyleDeclaration *)_typingStyle;
156 - (void)_setTypingStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebCore::EditAction)undoAction;
157 
158 - (void)_dragSourceMovedTo:(NSPoint)windowLoc;
159 - (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation;
160 
161 - (BOOL)_canProvideDocumentSource;
162 - (BOOL)_canSaveAsWebArchive;
163 
164 - (void)_receivedData:(NSData *)data textEncodingName:(NSString *)textEncodingName;
165 
166 @end
167 
168 @interface NSObject (WebInternalFrameLoadDelegate)
169 - (void)webFrame:(WebFrame *)webFrame didFinishLoadWithError:(NSError *)error;
170 @end
171