Home | History | Annotate | Download | only in WebView
      1 /*
      2  * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 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 DOMRange;
     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 
     73 - (BOOL)_isDescendantOfFrame:(WebFrame *)frame;
     74 - (void)_setShouldCreateRenderers:(BOOL)shouldCreateRenderers;
     75 - (NSColor *)_bodyBackgroundColor;
     76 - (BOOL)_isFrameSet;
     77 - (BOOL)_firstLayoutDone;
     78 - (WebFrameLoadType)_loadType;
     79 
     80 // These methods take and return NSRanges based on the root editable element as the positional base.
     81 // This fits with AppKit's idea of an input context. These methods are slow compared to their DOMRange equivalents.
     82 // You should use WebView's selectedDOMRange and setSelectedDOMRange whenever possible.
     83 - (NSRange)_selectedNSRange;
     84 - (void)_selectNSRange:(NSRange)range;
     85 
     86 - (BOOL)_isDisplayingStandaloneImage;
     87 
     88 - (unsigned)_pendingFrameUnloadEventCount;
     89 
     90 - (void)_setIsDisconnected:(bool)isDisconnected;
     91 - (void)_setExcludeFromTextSearch:(bool)exclude;
     92 
     93 #if ENABLE_NETSCAPE_PLUGIN_API
     94 - (void)_recursive_resumeNullEventsForAllNetscapePlugins;
     95 - (void)_recursive_pauseNullEventsForAllNetscapePlugins;
     96 #endif
     97 
     98 - (NSString *)_stringByEvaluatingJavaScriptFromString:(NSString *)string withGlobalObject:(JSObjectRef)globalObject inScriptWorld:(WebScriptWorld *)world;
     99 - (JSGlobalContextRef)_globalContextForScriptWorld:(WebScriptWorld *)world;
    100 
    101 // Pause a given CSS animation or transition on the target node at a specific time.
    102 // If the animation or transition is already paused, it will update its pause time.
    103 // This method is only intended to be used for testing the CSS animation and transition system.
    104 - (BOOL)_pauseAnimation:(NSString*)name onNode:(DOMNode *)node atTime:(NSTimeInterval)time;
    105 - (BOOL)_pauseTransitionOfProperty:(NSString*)name onNode:(DOMNode*)node atTime:(NSTimeInterval)time;
    106 
    107 // Pause a given SVG animation on the target node at a specific time.
    108 // This method is only intended to be used for testing the SVG animation system.
    109 - (BOOL)_pauseSVGAnimation:(NSString*)elementId onSMILNode:(DOMNode *)node atTime:(NSTimeInterval)time;
    110 
    111 // Returns the total number of currently running animations (includes both CSS transitions and CSS animations).
    112 - (unsigned)_numberOfActiveAnimations;
    113 
    114 // Suspend and resume animations (includes both CSS transitions and CSS animations).
    115 - (void)_suspendAnimations;
    116 - (void)_resumeAnimations;
    117 
    118 - (void)_replaceSelectionWithFragment:(DOMDocumentFragment *)fragment selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace matchStyle:(BOOL)matchStyle;
    119 - (void)_replaceSelectionWithText:(NSString *)text selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
    120 - (void)_replaceSelectionWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString selectReplacement:(BOOL)selectReplacement smartReplace:(BOOL)smartReplace;
    121 
    122 - (void)_smartInsertForString:(NSString *)pasteString replacingRange:(DOMRange *)rangeToReplace beforeString:(NSString **)beforeString afterString:(NSString **)afterString;
    123 
    124 - (NSMutableDictionary *)_cacheabilityDictionary;
    125 
    126 - (BOOL)_allowsFollowingLink:(NSURL *)URL;
    127 
    128 // Sets whether the scrollbars, if any, should be shown inside the document's border
    129 // (thus overlapping some content) or outside the webView's border (default behavior).
    130 // Changing this flag changes the size of the contentView and maintains the size of the frameView.
    131 - (void)setAllowsScrollersToOverlapContent:(BOOL)flag;
    132 
    133 // Sets if the scrollbar is always hidden, regardless of other scrollbar visibility settings.
    134 // This does not affect the scrollability of the document.
    135 - (void)setAlwaysHideHorizontalScroller:(BOOL)flag;
    136 - (void)setAlwaysHideVerticalScroller:(BOOL)flag;
    137 
    138 // Sets the name presented to accessibility clients for the web area object.
    139 - (void)setAccessibleName:(NSString *)name;
    140 
    141 - (NSString*)_layerTreeAsText;
    142 
    143 // Returns whether there is a spelling marker in the specified range of the focused node.
    144 - (BOOL)hasSpellingMarker:(int)location length:(int)length;
    145 
    146 - (BOOL)hasGrammarMarker:(int)from length:(int)length;
    147 
    148 // The top of the accessibility tree.
    149 - (id)accessibilityRoot;
    150 
    151 // Clears frame opener. This is executed between layout tests runs
    152 - (void)_clearOpener;
    153 
    154 // Printing.
    155 - (NSArray *)_computePageRectsWithPrintScaleFactor:(float)printWidthScaleFactor pageSize:(NSSize)pageSize;
    156 
    157 @end
    158