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