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 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/ContentFilter.h> 34#import <WebCore/EditAction.h> 35#import <WebCore/FrameLoaderTypes.h> 36#import <WebCore/FrameSelection.h> 37#import <WebCore/Position.h> 38#import <WebCore/Settings.h> 39 40@class DOMCSSStyleDeclaration; 41@class DOMDocumentFragment; 42@class DOMElement; 43@class DOMNode; 44@class DOMRange; 45@class WebFrameView; 46@class WebHistoryItem; 47 48class WebScriptDebugger; 49 50namespace WebCore { 51 class CSSStyleDeclaration; 52 class Document; 53 class DocumentLoader; 54 class Element; 55 class Frame; 56 class Frame; 57 class HistoryItem; 58 class HTMLElement; 59 class HTMLFrameOwnerElement; 60 class Node; 61 class Page; 62 class Range; 63} 64 65typedef WebCore::HistoryItem WebCoreHistoryItem; 66 67WebCore::Frame* core(WebFrame *); 68WebFrame *kit(WebCore::Frame *); 69 70WebCore::Page* core(WebView *); 71WebView *kit(WebCore::Page*); 72 73WebCore::EditableLinkBehavior core(WebKitEditableLinkBehavior); 74WebCore::TextDirectionSubmenuInclusionBehavior core(WebTextDirectionSubmenuInclusionBehavior); 75 76#if defined(__cplusplus) && PLATFORM(IOS) 77PassOwnPtr<Vector<Vector<String>>> vectorForDictationPhrasesArray(NSArray *); 78#endif 79 80WebView *getWebView(WebFrame *webFrame); 81 82@interface WebFramePrivate : NSObject { 83@public 84 WebCore::Frame* coreFrame; 85 WebFrameView *webFrameView; 86 std::unique_ptr<WebScriptDebugger> scriptDebugger; 87 id internalLoadDelegate; 88 BOOL shouldCreateRenderers; 89 BOOL includedInWebKitStatistics; 90 RetainPtr<NSString> url; 91 RetainPtr<NSString> provisionalURL; 92#if PLATFORM(IOS) 93 BOOL isCommitting; 94#endif 95 std::unique_ptr<WebCore::ContentFilter> contentFilterForBlockedLoad; 96} 97@end 98 99@protocol WebCoreRenderTreeCopier <NSObject> 100- (NSObject *)nodeWithName:(NSString *)name position:(NSPoint)position rect:(NSRect)rect view:(NSView *)view children:(NSArray *)children; 101@end 102 103@interface WebFrame (WebInternal) 104 105+ (void)_createMainFrameWithPage:(WebCore::Page*)page frameName:(const WTF::String&)name frameView:(WebFrameView *)frameView; 106+ (PassRefPtr<WebCore::Frame>)_createSubframeWithOwnerElement:(WebCore::HTMLFrameOwnerElement*)ownerElement frameName:(const WTF::String&)name frameView:(WebFrameView *)frameView; 107- (id)_initWithWebFrameView:(WebFrameView *)webFrameView webView:(WebView *)webView; 108 109- (void)_clearCoreFrame; 110 111- (BOOL)_isIncludedInWebKitStatistics; 112 113- (void)_updateBackgroundAndUpdatesWhileOffscreen; 114- (void)_setInternalLoadDelegate:(id)internalLoadDelegate; 115- (id)_internalLoadDelegate; 116- (void)_unmarkAllBadGrammar; 117- (void)_unmarkAllMisspellings; 118 119- (BOOL)_hasSelection; 120- (void)_clearSelection; 121- (WebFrame *)_findFrameWithSelection; 122- (void)_clearSelectionInOtherFrames; 123 124- (void)_attachScriptDebugger; 125- (void)_detachScriptDebugger; 126 127// dataSource reports null for the initial empty document's data source; this is needed 128// to preserve compatibility with Mail and Safari among others. But internal to WebKit, 129// we need to be able to get the initial data source as well, so the _dataSource method 130// should be used instead. 131- (WebDataSource *)_dataSource; 132 133#if PLATFORM(IOS) 134+ (void)_createMainFrameWithSimpleHTMLDocumentWithPage:(WebCore::Page*)page frameView:(WebFrameView *)frameView style:(NSString *)style; 135 136- (BOOL)_isCommitting; 137- (void)_setIsCommitting:(BOOL)value; 138#endif 139 140- (BOOL)_needsLayout; 141- (void)_drawRect:(NSRect)rect contentsOnly:(BOOL)contentsOnly; 142- (BOOL)_getVisibleRect:(NSRect*)rect; 143 144- (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string; 145- (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string forceUserGesture:(BOOL)forceUserGesture; 146 147- (NSString *)_selectedString; 148- (NSString *)_stringForRange:(DOMRange *)range; 149 150- (DOMRange *)_convertNSRangeToDOMRange:(NSRange)range; 151- (NSRange)_convertDOMRangeToNSRange:(DOMRange *)range; 152 153- (NSRect)_caretRectAtPosition:(const WebCore::Position&)pos affinity:(NSSelectionAffinity)affinity; 154- (NSRect)_firstRectForDOMRange:(DOMRange *)range; 155- (void)_scrollDOMRangeToVisible:(DOMRange *)range; 156#if PLATFORM(IOS) 157- (void)_scrollDOMRangeToVisible:(DOMRange *)range withInset:(CGFloat)inset; 158#endif 159 160#if !PLATFORM(IOS) 161- (DOMRange *)_rangeByAlteringCurrentSelection:(WebCore::FrameSelection::EAlteration)alteration direction:(WebCore::SelectionDirection)direction granularity:(WebCore::TextGranularity)granularity; 162#endif 163- (NSRange)_convertToNSRange:(WebCore::Range*)range; 164- (PassRefPtr<WebCore::Range>)_convertToDOMRange:(NSRange)nsrange; 165 166- (DOMDocumentFragment *)_documentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString; 167- (DOMDocumentFragment *)_documentFragmentWithNodesAsParagraphs:(NSArray *)nodes; 168 169- (void)_replaceSelectionWithNode:(DOMNode *)node selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle; 170 171- (void)_insertParagraphSeparatorInQuotedContent; 172 173- (DOMRange *)_characterRangeAtPoint:(NSPoint)point; 174 175- (DOMCSSStyleDeclaration *)_typingStyle; 176- (void)_setTypingStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(WebCore::EditAction)undoAction; 177 178#if ENABLE(DRAG_SUPPORT) 179- (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation; 180#endif 181 182- (BOOL)_canProvideDocumentSource; 183- (BOOL)_canSaveAsWebArchive; 184 185- (void)_commitData:(NSData *)data; 186 187- (BOOL)_contentFilterDidHandleNavigationAction:(const WebCore::ResourceRequest&)request; 188 189@end 190 191@interface NSObject (WebInternalFrameLoadDelegate) 192- (void)webFrame:(WebFrame *)webFrame didFinishLoadWithError:(NSError *)error; 193@end 194