Home | History | Annotate | Download | only in WebView
      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/Position.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 WebCore::EditingBehaviorType core(WebKitEditingBehavior);
     75 
     76 WebView *getWebView(WebFrame *webFrame);
     77 
     78 @interface WebFramePrivate : NSObject {
     79 @public
     80     WebCore::Frame* coreFrame;
     81     WebFrameView *webFrameView;
     82     WebScriptDebugger* scriptDebugger;
     83     id internalLoadDelegate;
     84     BOOL shouldCreateRenderers;
     85     BOOL includedInWebKitStatistics;
     86 }
     87 @end
     88 
     89 @protocol WebCoreRenderTreeCopier <NSObject>
     90 - (NSObject *)nodeWithName:(NSString *)name position:(NSPoint)position rect:(NSRect)rect view:(NSView *)view children:(NSArray *)children;
     91 @end
     92 
     93 @interface WebFrame (WebInternal)
     94 
     95 + (void)_createMainFrameWithPage:(WebCore::Page*)page frameName:(const WTF::String&)name frameView:(WebFrameView *)frameView;
     96 + (PassRefPtr<WebCore::Frame>)_createSubframeWithOwnerElement:(WebCore::HTMLFrameOwnerElement*)ownerElement frameName:(const WTF::String&)name frameView:(WebFrameView *)frameView;
     97 - (id)_initWithWebFrameView:(WebFrameView *)webFrameView webView:(WebView *)webView;
     98 
     99 - (void)_clearCoreFrame;
    100 
    101 - (BOOL)_isIncludedInWebKitStatistics;
    102 
    103 - (void)_updateBackgroundAndUpdatesWhileOffscreen;
    104 - (void)_setInternalLoadDelegate:(id)internalLoadDelegate;
    105 - (id)_internalLoadDelegate;
    106 #ifndef BUILDING_ON_TIGER
    107 - (void)_unmarkAllBadGrammar;
    108 #endif
    109 - (void)_unmarkAllMisspellings;
    110 
    111 - (BOOL)_hasSelection;
    112 - (void)_clearSelection;
    113 - (WebFrame *)_findFrameWithSelection;
    114 - (void)_clearSelectionInOtherFrames;
    115 
    116 - (void)_attachScriptDebugger;
    117 - (void)_detachScriptDebugger;
    118 
    119 // dataSource reports null for the initial empty document's data source; this is needed
    120 // to preserve compatibility with Mail and Safari among others. But internal to WebKit,
    121 // we need to be able to get the initial data source as well, so the _dataSource method
    122 // should be used instead.
    123 - (WebDataSource *)_dataSource;
    124 
    125 - (BOOL)_needsLayout;
    126 - (void)_drawRect:(NSRect)rect contentsOnly:(BOOL)contentsOnly;
    127 - (BOOL)_getVisibleRect:(NSRect*)rect;
    128 
    129 - (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string;
    130 - (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string forceUserGesture:(BOOL)forceUserGesture;
    131 
    132 - (NSString *)_selectedString;
    133 - (NSString *)_stringForRange:(DOMRange *)range;
    134 
    135 - (NSString *)_markupStringFromRange:(DOMRange *)range nodes:(NSArray **)nodes;
    136 
    137 - (NSRect)_caretRectAtPosition:(const WebCore::Position&)pos affinity:(NSSelectionAffinity)affinity;
    138 - (NSRect)_firstRectForDOMRange:(DOMRange *)range;
    139 - (void)_scrollDOMRangeToVisible:(DOMRange *)range;
    140 
    141 - (DOMRange *)_rangeByAlteringCurrentSelection:(WebCore::SelectionController::EAlteration)alteration direction:(WebCore::SelectionDirection)direction granularity:(WebCore::TextGranularity)granularity;
    142 - (NSRange)_convertToNSRange:(WebCore::Range*)range;
    143 - (DOMRange *)_convertNSRangeToDOMRange:(NSRange)range;
    144 - (NSRange)_convertDOMRangeToNSRange:(DOMRange *)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 - (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation;
    160 
    161 - (BOOL)_canProvideDocumentSource;
    162 - (BOOL)_canSaveAsWebArchive;
    163 
    164 - (void)_commitData:(NSData *)data;
    165 
    166 @end
    167 
    168 @interface NSObject (WebInternalFrameLoadDelegate)
    169 - (void)webFrame:(WebFrame *)webFrame didFinishLoadWithError:(NSError *)error;
    170 @end
    171