1/* 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 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#import <WebCore/EditAction.h> 34#import <WebCore/FrameLoaderTypes.h> 35#import <WebCore/FrameSelection.h> 36#import <WebCore/Position.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 47class WebScriptDebugger; 48 49namespace 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 64typedef WebCore::HistoryItem WebCoreHistoryItem; 65 66WebCore::Frame* core(WebFrame *); 67WebFrame *kit(WebCore::Frame *); 68 69WebCore::Page* core(WebView *); 70WebView *kit(WebCore::Page*); 71 72WebCore::EditableLinkBehavior core(WebKitEditableLinkBehavior); 73WebCore::TextDirectionSubmenuInclusionBehavior core(WebTextDirectionSubmenuInclusionBehavior); 74 75WebView *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 BOOL includedInWebKitStatistics; 85 RetainPtr<NSString> url; 86 RetainPtr<NSString> provisionalURL; 87} 88@end 89 90@protocol WebCoreRenderTreeCopier <NSObject> 91- (NSObject *)nodeWithName:(NSString *)name position:(NSPoint)position rect:(NSRect)rect view:(NSView *)view children:(NSArray *)children; 92@end 93 94@interface WebFrame (WebInternal) 95 96+ (void)_createMainFrameWithPage:(WebCore::Page*)page frameName:(const WTF::String&)name frameView:(WebFrameView *)frameView; 97+ (PassRefPtr<WebCore::Frame>)_createSubframeWithOwnerElement:(WebCore::HTMLFrameOwnerElement*)ownerElement frameName:(const WTF::String&)name frameView:(WebFrameView *)frameView; 98- (id)_initWithWebFrameView:(WebFrameView *)webFrameView webView:(WebView *)webView; 99 100- (void)_clearCoreFrame; 101 102- (BOOL)_isIncludedInWebKitStatistics; 103 104- (void)_updateBackgroundAndUpdatesWhileOffscreen; 105- (void)_setInternalLoadDelegate:(id)internalLoadDelegate; 106- (id)_internalLoadDelegate; 107- (void)_unmarkAllBadGrammar; 108- (void)_unmarkAllMisspellings; 109 110- (BOOL)_hasSelection; 111- (void)_clearSelection; 112- (WebFrame *)_findFrameWithSelection; 113- (void)_clearSelectionInOtherFrames; 114 115- (void)_attachScriptDebugger; 116- (void)_detachScriptDebugger; 117 118// dataSource reports null for the initial empty document's data source; this is needed 119// to preserve compatibility with Mail and Safari among others. But internal to WebKit, 120// we need to be able to get the initial data source as well, so the _dataSource method 121// should be used instead. 122- (WebDataSource *)_dataSource; 123 124- (BOOL)_needsLayout; 125- (void)_drawRect:(NSRect)rect contentsOnly:(BOOL)contentsOnly; 126- (BOOL)_getVisibleRect:(NSRect*)rect; 127 128- (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string; 129- (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string forceUserGesture:(BOOL)forceUserGesture; 130 131- (NSString *)_selectedString; 132- (NSString *)_stringForRange:(DOMRange *)range; 133 134- (DOMRange *)_convertNSRangeToDOMRange:(NSRange)range; 135- (NSRange)_convertDOMRangeToNSRange:(DOMRange *)range; 136 137- (NSString *)_markupStringFromRange:(DOMRange *)range nodes:(NSArray **)nodes; 138 139- (NSRect)_caretRectAtPosition:(const WebCore::Position&)pos affinity:(NSSelectionAffinity)affinity; 140- (NSRect)_firstRectForDOMRange:(DOMRange *)range; 141- (void)_scrollDOMRangeToVisible:(DOMRange *)range; 142 143- (DOMRange *)_rangeByAlteringCurrentSelection:(WebCore::FrameSelection::EAlteration)alteration direction:(WebCore::SelectionDirection)direction granularity:(WebCore::TextGranularity)granularity; 144- (NSRange)_convertToNSRange:(WebCore::Range*)range; 145- (PassRefPtr<WebCore::Range>)_convertToDOMRange:(NSRange)nsrange; 146 147- (DOMDocumentFragment *)_documentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString; 148- (DOMDocumentFragment *)_documentFragmentWithNodesAsParagraphs:(NSArray *)nodes; 149 150- (void)_replaceSelectionWithNode:(DOMNode *)node selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle; 151 152- (void)_insertParagraphSeparatorInQuotedContent; 153 154- (DOMRange *)_characterRangeAtPoint:(NSPoint)point; 155 156- (DOMCSSStyleDeclaration *)_typingStyle; 157- (void)_setTypingStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebCore::EditAction)undoAction; 158 159#if ENABLE(DRAG_SUPPORT) 160- (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation; 161#endif 162 163- (BOOL)_canProvideDocumentSource; 164- (BOOL)_canSaveAsWebArchive; 165 166- (void)_commitData:(NSData *)data; 167 168@end 169 170@interface NSObject (WebInternalFrameLoadDelegate) 171- (void)webFrame:(WebFrame *)webFrame didFinishLoadWithError:(NSError *)error; 172@end 173