1 /* 2 * Copyright (C) 2005 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 * 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 the WebFrame SPI. 30 31 #import <WebKit/WebFrame.h> 32 #import <JavaScriptCore/JSBase.h> 33 34 #if !defined(ENABLE_NETSCAPE_PLUGIN_API) 35 #define ENABLE_NETSCAPE_PLUGIN_API 1 36 #endif 37 38 @class DOMDocumentFragment; 39 @class DOMNode; 40 @class WebIconFetcher; 41 @class WebScriptObject; 42 @class WebScriptWorld; 43 44 // Keys for accessing the values in the page cache dictionary. 45 extern NSString *WebPageCacheEntryDateKey; 46 extern NSString *WebPageCacheDataSourceKey; 47 extern NSString *WebPageCacheDocumentViewKey; 48 49 extern NSString *WebFrameMainDocumentError; 50 extern NSString *WebFrameHasPlugins; 51 extern NSString *WebFrameHasUnloadListener; 52 extern NSString *WebFrameUsesDatabases; 53 extern NSString *WebFrameUsesGeolocation; 54 extern NSString *WebFrameUsesApplicationCache; 55 extern NSString *WebFrameCanSuspendActiveDOMObjects; 56 57 typedef enum { 58 WebFrameLoadTypeStandard, 59 WebFrameLoadTypeBack, 60 WebFrameLoadTypeForward, 61 WebFrameLoadTypeIndexedBackForward, // a multi-item hop in the backforward list 62 WebFrameLoadTypeReload, 63 WebFrameLoadTypeReloadAllowingStaleData, 64 WebFrameLoadTypeSame, // user loads same URL again (but not reload button) 65 WebFrameLoadTypeInternal, // maps to WebCore::FrameLoadTypeRedirectWithLockedBackForwardList 66 WebFrameLoadTypeReplace, 67 WebFrameLoadTypeReloadFromOrigin, 68 WebFrameLoadTypeBackWMLDeckNotAccessible 69 } WebFrameLoadType; 70 71 @interface WebFrame (WebPrivate) 72 - (BOOL)_isDescendantOfFrame:(WebFrame *)frame; 73 - (void)_setShouldCreateRenderers:(BOOL)f; 74 - (NSColor *)_bodyBackgroundColor; 75 - (BOOL)_isFrameSet; 76 - (BOOL)_firstLayoutDone; 77 - (WebFrameLoadType)_loadType; 78 79 // These methods take and return NSRanges based on the root editable element as the positional base. 80 // This fits with AppKit's idea of an input context. These methods are slow compared to their DOMRange equivalents. 81 // You should use WebView's selectedDOMRange and setSelectedDOMRange whenever possible. 82 - (NSRange)_selectedNSRange; 83 - (void)_selectNSRange:(NSRange)range; 84 85 - (BOOL)_isDisplayingStandaloneImage; 86 87 - (unsigned) _pendingFrameUnloadEventCount; 88 89 - (WebIconFetcher *)fetchApplicationIcon:(id)target 90 selector:(SEL)selector; 91 92 - (void)_setIsDisconnected:(bool)isDisconnected; 93 - (void)_setExcludeFromTextSearch:(bool)exclude; 94 95 #if ENABLE_NETSCAPE_PLUGIN_API 96 - (void)_recursive_resumeNullEventsForAllNetscapePlugins; 97 - (void)_recursive_pauseNullEventsForAllNetscapePlugins; 98 #endif 99 100 - (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string withGlobalObject:(JSObjectRef)globalObject inScriptWorld:(WebScriptWorld *)world; 101 - (JSGlobalContextRef)_globalContextForScriptWorld:(WebScriptWorld *)world; 102 103 // Pause a given CSS animation or transition on the target node at a specific time. 104 // If the animation or transition is already paused, it will update its pause time. 105 // This method is only intended to be used for testing the CSS animation and transition system. 106 - (BOOL)_pauseAnimation:(NSString*)name onNode:(DOMNode *)node atTime:(NSTimeInterval)time; 107 - (BOOL)_pauseTransitionOfProperty:(NSString*)name onNode:(DOMNode*)node atTime:(NSTimeInterval)time; 108 109 // Pause a given SVG animation on the target node at a specific time. 110 // This method is only intended to be used for testing the SVG animation system. 111 - (BOOL)_pauseSVGAnimation:(NSString*)elementId onSMILNode:(DOMNode *)node atTime:(NSTimeInterval)time; 112 113 // Returns the total number of currently running animations (includes both CSS transitions and CSS animations). 114 - (unsigned) _numberOfActiveAnimations; 115 116 - (void)_replaceSelectionWithFragment:(DOMDocumentFragment *)fragment selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle; 117 - (void)_replaceSelectionWithText:(NSString *)text selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace; 118 - (void)_replaceSelectionWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace; 119 120 - (NSMutableDictionary *)_cacheabilityDictionary; 121 122 - (BOOL)_allowsFollowingLink:(NSURL *)URL; 123 @end 124