Home | History | Annotate | Download | only in WebView
      1 /*
      2  * Copyright (C) 2005, 2006, 2007, 2008, 2009 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 #import <WebKit/WebView.h>
     30 #import <WebKit/WebFramePrivate.h>
     31 #import <JavaScriptCore/JSBase.h>
     32 
     33 #if !defined(ENABLE_DASHBOARD_SUPPORT)
     34 #define ENABLE_DASHBOARD_SUPPORT 1
     35 #endif
     36 
     37 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
     38 #define WebNSInteger int
     39 #define WebNSUInteger unsigned int
     40 #else
     41 #define WebNSInteger NSInteger
     42 #define WebNSUInteger NSUInteger
     43 #endif
     44 
     45 @class NSError;
     46 @class WebFrame;
     47 @class WebDeviceOrientation;
     48 @class WebGeolocationPosition;
     49 @class WebInspector;
     50 @class WebPreferences;
     51 @class WebScriptWorld;
     52 @class WebTextIterator;
     53 
     54 @protocol WebDeviceOrientationProvider;
     55 @protocol WebFormDelegate;
     56 
     57 extern NSString *_WebCanGoBackKey;
     58 extern NSString *_WebCanGoForwardKey;
     59 extern NSString *_WebEstimatedProgressKey;
     60 extern NSString *_WebIsLoadingKey;
     61 extern NSString *_WebMainFrameIconKey;
     62 extern NSString *_WebMainFrameTitleKey;
     63 extern NSString *_WebMainFrameURLKey;
     64 extern NSString *_WebMainFrameDocumentKey;
     65 
     66 // pending public WebElementDictionary keys
     67 extern NSString *WebElementTitleKey;             // NSString of the title of the element (used by Safari)
     68 extern NSString *WebElementSpellingToolTipKey;   // NSString of a tooltip representing misspelling or bad grammar (used internally)
     69 extern NSString *WebElementIsContentEditableKey; // NSNumber indicating whether the inner non-shared node is content editable (used internally)
     70 extern NSString *WebElementMediaURLKey;          // NSURL of the media element
     71 
     72 // other WebElementDictionary keys
     73 extern NSString *WebElementLinkIsLiveKey;        // NSNumber of BOOL indicating whether the link is live or not
     74 extern NSString *WebElementIsInScrollBarKey;
     75 
     76 // One of the subviews of the WebView entered compositing mode.
     77 extern NSString *_WebViewDidStartAcceleratedCompositingNotification;
     78 
     79 #if ENABLE_DASHBOARD_SUPPORT
     80 typedef enum {
     81     WebDashboardBehaviorAlwaysSendMouseEventsToAllWindows,
     82     WebDashboardBehaviorAlwaysSendActiveNullEventsToPlugIns,
     83     WebDashboardBehaviorAlwaysAcceptsFirstMouse,
     84     WebDashboardBehaviorAllowWheelScrolling,
     85     WebDashboardBehaviorUseBackwardCompatibilityMode
     86 } WebDashboardBehavior;
     87 #endif
     88 
     89 typedef enum {
     90     WebInjectAtDocumentStart,
     91     WebInjectAtDocumentEnd,
     92 } WebUserScriptInjectionTime;
     93 
     94 typedef enum {
     95     WebInjectInAllFrames,
     96     WebInjectInTopFrameOnly
     97 } WebUserContentInjectedFrames;
     98 
     99 enum {
    100     WebFindOptionsCaseInsensitive = 1 << 0,
    101     WebFindOptionsAtWordStarts = 1 << 1,
    102     WebFindOptionsTreatMedialCapitalAsWordStart = 1 << 2,
    103     WebFindOptionsBackwards = 1 << 3,
    104     WebFindOptionsWrapAround = 1 << 4,
    105     WebFindOptionsStartInSelection = 1 << 5
    106 };
    107 typedef NSUInteger WebFindOptions;
    108 
    109 @interface WebController : NSTreeController {
    110     IBOutlet WebView *webView;
    111 }
    112 - (WebView *)webView;
    113 - (void)setWebView:(WebView *)newWebView;
    114 @end
    115 
    116 @interface WebView (WebViewEditingActionsPendingPublic)
    117 
    118 - (void)outdent:(id)sender;
    119 
    120 @end
    121 
    122 @interface WebView (WebPendingPublic)
    123 
    124 - (void)scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode;
    125 - (void)unscheduleFromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode;
    126 
    127 - (BOOL)findString:(NSString *)string options:(WebFindOptions)options;
    128 
    129 - (void)setMainFrameDocumentReady:(BOOL)mainFrameDocumentReady;
    130 
    131 - (void)setTabKeyCyclesThroughElements:(BOOL)cyclesElements;
    132 - (BOOL)tabKeyCyclesThroughElements;
    133 
    134 - (void)scrollDOMRangeToVisible:(DOMRange *)range;
    135 
    136 // setHoverFeedbackSuspended: can be called by clients that want to temporarily prevent the webView
    137 // from displaying feedback about mouse position. Each WebDocumentView class that displays feedback
    138 // about mouse position should honor this setting.
    139 - (void)setHoverFeedbackSuspended:(BOOL)newValue;
    140 - (BOOL)isHoverFeedbackSuspended;
    141 
    142 /*!
    143 @method setScriptDebugDelegate:
    144 @abstract Set the WebView's WebScriptDebugDelegate delegate.
    145 @param delegate The WebScriptDebugDelegate to set as the delegate.
    146 */
    147 - (void)setScriptDebugDelegate:(id)delegate;
    148 
    149 /*!
    150 @method scriptDebugDelegate
    151 @abstract Return the WebView's WebScriptDebugDelegate.
    152 @result The WebView's WebScriptDebugDelegate.
    153 */
    154 - (id)scriptDebugDelegate;
    155 
    156 /*!
    157     @method setHistoryDelegate:
    158     @abstract Set the WebView's WebHistoryDelegate delegate.
    159     @param delegate The WebHistoryDelegate to set as the delegate.
    160 */
    161 - (void)setHistoryDelegate:(id)delegate;
    162 
    163 /*!
    164     @method historyDelegate
    165     @abstract Return the WebView's WebHistoryDelegate delegate.
    166     @result The WebView's WebHistoryDelegate delegate.
    167 */
    168 - (id)historyDelegate;
    169 
    170 - (BOOL)shouldClose;
    171 
    172 /*!
    173     @method aeDescByEvaluatingJavaScriptFromString:
    174     @param script The text of the JavaScript.
    175     @result The result of the script, converted to an NSAppleEventDescriptor, or nil for failure.
    176 */
    177 - (NSAppleEventDescriptor *)aeDescByEvaluatingJavaScriptFromString:(NSString *)script;
    178 
    179 // Support for displaying multiple text matches.
    180 // These methods might end up moving into a protocol, so different document types can specify
    181 // whether or not they implement the protocol. For now we'll just deal with HTML.
    182 // These methods are still in flux; don't rely on them yet.
    183 - (BOOL)canMarkAllTextMatches;
    184 - (WebNSUInteger)countMatchesForText:(NSString *)string options:(WebFindOptions)options highlight:(BOOL)highlight limit:(WebNSUInteger)limit markMatches:(BOOL)markMatches;
    185 - (WebNSUInteger)countMatchesForText:(NSString *)string inDOMRange:(DOMRange *)range options:(WebFindOptions)options highlight:(BOOL)highlight limit:(WebNSUInteger)limit markMatches:(BOOL)markMatches;
    186 - (void)unmarkAllTextMatches;
    187 - (NSArray *)rectsForTextMatches;
    188 
    189 // Support for disabling registration with the undo manager. This is equivalent to the methods with the same names on NSTextView.
    190 - (BOOL)allowsUndo;
    191 - (void)setAllowsUndo:(BOOL)flag;
    192 
    193 /*!
    194     @method setPageSizeMultiplier:
    195     @abstract Change the zoom factor of the page in views managed by this webView.
    196     @param multiplier A fractional percentage value, 1.0 is 100%.
    197 */
    198 - (void)setPageSizeMultiplier:(float)multiplier;
    199 
    200 /*!
    201     @method pageSizeMultiplier
    202     @result The page size multipler.
    203 */
    204 - (float)pageSizeMultiplier;
    205 
    206 // Commands for doing page zoom.  Will end up in WebView (WebIBActions) <NSUserInterfaceValidations>
    207 - (BOOL)canZoomPageIn;
    208 - (IBAction)zoomPageIn:(id)sender;
    209 - (BOOL)canZoomPageOut;
    210 - (IBAction)zoomPageOut:(id)sender;
    211 - (BOOL)canResetPageZoom;
    212 - (IBAction)resetPageZoom:(id)sender;
    213 
    214 // Sets a master volume control for all media elements in the WebView. Valid values are 0..1.
    215 - (void)setMediaVolume:(float)volume;
    216 - (float)mediaVolume;
    217 
    218 // Add visited links
    219 - (void)addVisitedLinks:(NSArray *)visitedLinks;
    220 
    221 @end
    222 
    223 @interface WebView (WebPrivate)
    224 
    225 - (WebInspector *)inspector;
    226 
    227 /*!
    228     @method setBackgroundColor:
    229     @param backgroundColor Color to use as the default background.
    230     @abstract Sets what color the receiver draws under transparent page background colors and images.
    231     This color is also used when no page is loaded. A color with alpha should only be used when the receiver is
    232     in a non-opaque window, since the color is drawn using NSCompositeCopy.
    233 */
    234 - (void)setBackgroundColor:(NSColor *)backgroundColor;
    235 
    236 /*!
    237     @method backgroundColor
    238     @result Returns the background color drawn under transparent page background colors and images.
    239     This color is also used when no page is loaded. A color with alpha should only be used when the receiver is
    240     in a non-opaque window, since the color is drawn using NSCompositeCopy.
    241 */
    242 - (NSColor *)backgroundColor;
    243 
    244 /*!
    245 Could be worth adding to the API.
    246  @method _loadBackForwardListFromOtherView:
    247  @abstract Loads the view with the contents of the other view, including its backforward list.
    248  @param otherView   The WebView from which to copy contents.
    249  */
    250 - (void)_loadBackForwardListFromOtherView:(WebView *)otherView;
    251 
    252 /*
    253  @method _reportException:inContext:
    254  @abstract Logs the exception to the Web Inspector. This only needs called for exceptions that
    255  occur while using the JavaScriptCore APIs with a context owned by a WebKit.
    256  @param exception The exception value to log.
    257  @param context   The context the exception occured in.
    258 */
    259 + (void)_reportException:(JSValueRef)exception inContext:(JSContextRef)context;
    260 
    261 /*!
    262  @method _dispatchPendingLoadRequests:
    263  @abstract Dispatches any pending load requests that have been scheduled because of recent DOM additions or style changes.
    264  @discussion You only need to call this method if you require synchronous notification of loads through the resource load delegate.
    265  Otherwise the resource load delegate will be notified about loads during a future run loop iteration.
    266  */
    267 - (void)_dispatchPendingLoadRequests;
    268 
    269 + (NSArray *)_supportedFileExtensions;
    270 
    271 /*!
    272     @method canShowFile:
    273     @abstract Checks if the WebKit can show the content of the file at the specified path.
    274     @param path The path of the file to check
    275     @result YES if the WebKit can show the content of the file at the specified path.
    276 */
    277 + (BOOL)canShowFile:(NSString *)path;
    278 
    279 /*!
    280     @method suggestedFileExtensionForMIMEType:
    281     @param MIMEType The MIME type to check.
    282     @result The extension based on the MIME type
    283 */
    284 + (NSString *)suggestedFileExtensionForMIMEType: (NSString *)MIMEType;
    285 
    286 + (NSString *)_standardUserAgentWithApplicationName:(NSString *)applicationName;
    287 
    288 /*!
    289     @method canCloseAllWebViews
    290     @abstract Checks if all the open WebViews can be closed (by dispatching the beforeUnload event to the pages).
    291     @result YES if all the WebViews can be closed.
    292 */
    293 + (BOOL)canCloseAllWebViews;
    294 
    295 // May well become public
    296 - (void)_setFormDelegate:(id<WebFormDelegate>)delegate;
    297 - (id<WebFormDelegate>)_formDelegate;
    298 
    299 - (BOOL)_isClosed;
    300 
    301 // _close is now replaced by public method -close. It remains here only for backward compatibility
    302 // until callers can be weaned off of it.
    303 - (void)_close;
    304 
    305 // Indicates if the WebView is in the midst of a user gesture.
    306 - (BOOL)_isProcessingUserGesture;
    307 
    308 // SPI for DumpRenderTree
    309 - (void)_updateActiveState;
    310 
    311 /*!
    312     @method _registerViewClass:representationClass:forURLScheme:
    313     @discussion Register classes that implement WebDocumentView and WebDocumentRepresentation respectively.
    314     @param viewClass The WebDocumentView class to use to render data for a given MIME type.
    315     @param representationClass The WebDocumentRepresentation class to use to represent data of the given MIME type.
    316     @param scheme The URL scheme to represent with an object of the given class.
    317 */
    318 + (void)_registerViewClass:(Class)viewClass representationClass:(Class)representationClass forURLScheme:(NSString *)URLScheme;
    319 
    320 + (void)_unregisterViewClassAndRepresentationClassForMIMEType:(NSString *)MIMEType;
    321 
    322 /*!
    323      @method _canHandleRequest:
    324      @abstract Performs a "preflight" operation that performs some
    325      speculative checks to see if a request can be used to create
    326      a WebDocumentView and WebDocumentRepresentation.
    327      @discussion The result of this method is valid only as long as no
    328      protocols or schemes are registered or unregistered, and as long as
    329      the request is not mutated (if the request is mutable). Hence, clients
    330      should be prepared to handle failures even if they have performed request
    331      preflighting by caling this method.
    332      @param request The request to preflight.
    333      @result YES if it is likely that a WebDocumentView and WebDocumentRepresentation
    334      can be created for the request, NO otherwise.
    335 */
    336 + (BOOL)_canHandleRequest:(NSURLRequest *)request;
    337 
    338 + (NSString *)_decodeData:(NSData *)data;
    339 
    340 + (void)_setAlwaysUsesComplexTextCodePath:(BOOL)f;
    341 // This is the old name of the above method. Needed for Safari versions that call it.
    342 + (void)_setAlwaysUseATSU:(BOOL)f;
    343 
    344 - (NSCachedURLResponse *)_cachedResponseForURL:(NSURL *)URL;
    345 
    346 #if ENABLE_DASHBOARD_SUPPORT
    347 - (void)_addScrollerDashboardRegions:(NSMutableDictionary *)regions;
    348 - (NSDictionary *)_dashboardRegions;
    349 
    350 - (void)_setDashboardBehavior:(WebDashboardBehavior)behavior to:(BOOL)flag;
    351 - (BOOL)_dashboardBehavior:(WebDashboardBehavior)behavior;
    352 #endif
    353 
    354 + (void)_setShouldUseFontSmoothing:(BOOL)f;
    355 + (BOOL)_shouldUseFontSmoothing;
    356 
    357 - (void)_setCatchesDelegateExceptions:(BOOL)f;
    358 - (BOOL)_catchesDelegateExceptions;
    359 
    360 // These two methods are useful for a test harness that needs a consistent appearance for the focus rings
    361 // regardless of OS X version.
    362 + (void)_setUsesTestModeFocusRingColor:(BOOL)f;
    363 + (BOOL)_usesTestModeFocusRingColor;
    364 
    365 /*!
    366     @method setAlwaysShowVerticalScroller:
    367     @result Forces the vertical scroller to be visible if flag is YES, otherwise
    368     if flag is NO the scroller with automatically show and hide as needed.
    369  */
    370 - (void)setAlwaysShowVerticalScroller:(BOOL)flag;
    371 
    372 /*!
    373     @method alwaysShowVerticalScroller
    374     @result YES if the vertical scroller is always shown
    375  */
    376 - (BOOL)alwaysShowVerticalScroller;
    377 
    378 /*!
    379     @method setAlwaysShowHorizontalScroller:
    380     @result Forces the horizontal scroller to be visible if flag is YES, otherwise
    381     if flag is NO the scroller with automatically show and hide as needed.
    382  */
    383 - (void)setAlwaysShowHorizontalScroller:(BOOL)flag;
    384 
    385 /*!
    386     @method alwaysShowHorizontalScroller
    387     @result YES if the horizontal scroller is always shown
    388  */
    389 - (BOOL)alwaysShowHorizontalScroller;
    390 
    391 /*!
    392     @method setProhibitsMainFrameScrolling:
    393     @abstract Prohibits scrolling in the WebView's main frame.  Used to "lock" a WebView
    394     to a specific scroll position.
    395   */
    396 - (void)setProhibitsMainFrameScrolling:(BOOL)prohibits;
    397 
    398 /*!
    399     @method _setAdditionalWebPlugInPaths:
    400     @abstract Sets additional plugin search paths for a specific WebView.
    401  */
    402 - (void)_setAdditionalWebPlugInPaths:(NSArray *)newPaths;
    403 
    404 /*!
    405     @method _setInViewSourceMode:
    406     @abstract Used to place a WebView into a special source-viewing mode.
    407   */
    408 - (void)_setInViewSourceMode:(BOOL)flag;
    409 
    410 /*!
    411     @method _inViewSourceMode;
    412     @abstract Whether or not the WebView is in source-view mode for HTML.
    413   */
    414 - (BOOL)_inViewSourceMode;
    415 
    416 /*!
    417     @method _attachScriptDebuggerToAllFrames
    418     @abstract Attaches a script debugger to all frames belonging to the receiver.
    419  */
    420 - (void)_attachScriptDebuggerToAllFrames;
    421 
    422 /*!
    423     @method _detachScriptDebuggerFromAllFrames
    424     @abstract Detaches any script debuggers from all frames belonging to the receiver.
    425  */
    426 - (void)_detachScriptDebuggerFromAllFrames;
    427 
    428 - (BOOL)defersCallbacks; // called by QuickTime plug-in
    429 - (void)setDefersCallbacks:(BOOL)defer; // called by QuickTime plug-in
    430 
    431 - (BOOL)usesPageCache;
    432 - (void)setUsesPageCache:(BOOL)usesPageCache;
    433 
    434 - (WebHistoryItem *)_globalHistoryItem;
    435 
    436 /*!
    437     @method textIteratorForRect:
    438     @param rect The rectangle of the document that we're interested in text from.
    439     @result WebTextIterator object, initialized with a range that corresponds to
    440     the passed-in rectangle.
    441     @abstract This method gives the text for the approximate range of the document
    442     corresponding to the rectangle. The range is determined by using hit testing at
    443     the top left and bottom right of the rectangle. Because of that, there can be
    444     text visible in the rectangle that is not included in the iterator. If you need
    445     a guarantee of iterating all text that is visible, then you need to instead make
    446     a WebTextIterator with a DOMRange that covers the entire document.
    447  */
    448 - (WebTextIterator *)textIteratorForRect:(NSRect)rect;
    449 
    450 #if ENABLE_DASHBOARD_SUPPORT
    451 // <rdar://problem/5217124> Clients other than Dashboard, don't use this.
    452 // As of this writing, Dashboard uses this on Tiger, but not on Leopard or newer.
    453 - (void)handleAuthenticationForResource:(id)identifier challenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource;
    454 #endif
    455 
    456 - (void)_clearUndoRedoOperations;
    457 
    458 /* Used to do fast (lower quality) scaling of images so that window resize can be quick. */
    459 - (BOOL)_inFastImageScalingMode;
    460 - (void)_setUseFastImageScalingMode:(BOOL)flag;
    461 
    462 - (BOOL)_cookieEnabled;
    463 - (void)_setCookieEnabled:(BOOL)enable;
    464 
    465 // SPI for DumpRenderTree
    466 - (void)_executeCoreCommandByName:(NSString *)name value:(NSString *)value;
    467 - (void)_clearMainFrameName;
    468 
    469 - (void)_setCustomHTMLTokenizerTimeDelay:(double)timeDelay;
    470 - (void)_setCustomHTMLTokenizerChunkSize:(int)chunkSize;
    471 
    472 - (id)_initWithFrame:(NSRect)f frameName:(NSString *)frameName groupName:(NSString *)groupName usesDocumentViews:(BOOL)usesDocumentViews;
    473 - (BOOL)_usesDocumentViews;
    474 
    475 - (void)setSelectTrailingWhitespaceEnabled:(BOOL)flag;
    476 - (BOOL)isSelectTrailingWhitespaceEnabled;
    477 
    478 - (void)setMemoryCacheDelegateCallsEnabled:(BOOL)suspend;
    479 - (BOOL)areMemoryCacheDelegateCallsEnabled;
    480 
    481 - (void)_setJavaScriptURLsAreAllowed:(BOOL)setJavaScriptURLsAreAllowed;
    482 
    483 + (NSCursor *)_pointingHandCursor;
    484 
    485 // SPI for DumpRenderTree
    486 - (BOOL)_postsAcceleratedCompositingNotifications;
    487 - (void)_setPostsAcceleratedCompositingNotifications:(BOOL)flag;
    488 - (BOOL)_isUsingAcceleratedCompositing;
    489 
    490 // For DumpRenderTree
    491 - (BOOL)interactiveFormValidationEnabled;
    492 - (void)setInteractiveFormValidationEnabled:(BOOL)enabled;
    493 - (int)validationMessageTimerMagnification;
    494 - (void)setValidationMessageTimerMagnification:(int)newValue;
    495 
    496 // Returns YES if NSView -displayRectIgnoringOpacity:inContext: will produce a faithful representation of the content.
    497 - (BOOL)_isSoftwareRenderable;
    498 // When drawing into a bitmap context, we normally flatten compositing layers (and distort 3D transforms).
    499 // Clients who are able to capture their own copy of the compositing layers need to be able to disable this.
    500 - (void)_setIncludesFlattenedCompositingLayersWhenDrawingToBitmap:(BOOL)flag;
    501 - (BOOL)_includesFlattenedCompositingLayersWhenDrawingToBitmap;
    502 
    503 // SPI for PluginHalter
    504 + (BOOL)_isNodeHaltedPlugin:(DOMNode *)node;
    505 + (BOOL)_hasPluginForNodeBeenHalted:(DOMNode *)node;
    506 + (void)_restartHaltedPluginForNode:(DOMNode *)node;
    507 
    508 // Which pasteboard text is coming from in editing delegate methods such as shouldInsertNode.
    509 - (NSPasteboard *)_insertionPasteboard;
    510 
    511 // Whitelists access from an origin (sourceOrigin) to a set of one or more origins described by the parameters:
    512 // - destinationProtocol: The protocol to grant access to.
    513 // - destinationHost: The host to grant access to.
    514 // - allowDestinationSubdomains: If host is a domain, setting this to YES will whitelist host and all its subdomains, recursively.
    515 + (void)_addOriginAccessWhitelistEntryWithSourceOrigin:(NSString *)sourceOrigin destinationProtocol:(NSString *)destinationProtocol destinationHost:(NSString *)destinationHost allowDestinationSubdomains:(BOOL)allowDestinationSubdomains;
    516 + (void)_removeOriginAccessWhitelistEntryWithSourceOrigin:(NSString *)sourceOrigin destinationProtocol:(NSString *)destinationProtocol destinationHost:(NSString *)destinationHost allowDestinationSubdomains:(BOOL)allowDestinationSubdomains;
    517 
    518 // Removes all white list entries created with _addOriginAccessWhitelistEntryWithSourceOrigin.
    519 + (void)_resetOriginAccessWhitelists;
    520 
    521 // FIXME: The following two methods are deprecated in favor of the overloads below that take the WebUserContentInjectedFrames argument. https://bugs.webkit.org/show_bug.cgi?id=41800.
    522 + (void)_addUserScriptToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectionTime:(WebUserScriptInjectionTime)injectionTime;
    523 + (void)_addUserStyleSheetToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist;
    524 
    525 + (void)_addUserScriptToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectionTime:(WebUserScriptInjectionTime)injectionTime injectedFrames:(WebUserContentInjectedFrames)injectedFrames;
    526 + (void)_addUserStyleSheetToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectedFrames:(WebUserContentInjectedFrames)injectedFrames;
    527 + (void)_removeUserScriptFromGroup:(NSString *)groupName world:(WebScriptWorld *)world url:(NSURL *)url;
    528 + (void)_removeUserStyleSheetFromGroup:(NSString *)groupName world:(WebScriptWorld *)world url:(NSURL *)url;
    529 + (void)_removeUserScriptsFromGroup:(NSString *)groupName world:(WebScriptWorld *)world;
    530 + (void)_removeUserStyleSheetsFromGroup:(NSString *)groupName world:(WebScriptWorld *)world;
    531 + (void)_removeAllUserContentFromGroup:(NSString *)groupName;
    532 
    533 // SPI for DumpRenderTree
    534 + (void)_setLoadResourcesSerially:(BOOL)serialize;
    535 
    536 /*!
    537     @method cssAnimationsSuspended
    538     @abstract Returns whether or not CSS Animations are suspended.
    539     @result YES if CSS Animations are suspended.
    540 */
    541 - (BOOL)cssAnimationsSuspended;
    542 
    543 /*!
    544     @method setCSSAnimationsSuspended
    545     @param paused YES to suspend animations, NO to resume animations.
    546     @discussion Suspends or resumes all running animations and transitions in the page.
    547 */
    548 - (void)setCSSAnimationsSuspended:(BOOL)suspended;
    549 
    550 + (void)_setDomainRelaxationForbidden:(BOOL)forbidden forURLScheme:(NSString *)scheme;
    551 + (void)_registerURLSchemeAsSecure:(NSString *)scheme;
    552 
    553 - (void)_scaleWebView:(float)scale atOrigin:(NSPoint)origin;
    554 - (float)_viewScaleFactor;
    555 
    556 - (void)_setUseFixedLayout:(BOOL)fixed;
    557 - (void)_setFixedLayoutSize:(NSSize)size;
    558 
    559 - (BOOL)_useFixedLayout;
    560 - (NSSize)_fixedLayoutSize;
    561 
    562 // Deprecated. Use the methods in pending public above instead.
    563 - (WebNSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(WebNSUInteger)limit;
    564 - (WebNSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(WebNSUInteger)limit markMatches:(BOOL)markMatches;
    565 
    566 /*!
    567  @method searchFor:direction:caseSensitive:wrap:startInSelection:
    568  @abstract Searches a document view for a string and highlights the string if it is found.
    569  Starts the search from the current selection.  Will search across all frames.
    570  @param string The string to search for.
    571  @param forward YES to search forward, NO to seach backwards.
    572  @param caseFlag YES to for case-sensitive search, NO for case-insensitive search.
    573  @param wrapFlag YES to wrap around, NO to avoid wrapping.
    574  @param startInSelection YES to begin search in the selected text (useful for incremental searching), NO to begin search after the selected text.
    575  @result YES if found, NO if not found.
    576  */
    577 // Deprecated. Use findString.
    578 - (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag startInSelection:(BOOL)startInSelection;
    579 
    580 /*!
    581     @method defaultMinimumTimerInterval
    582     @discussion Should consider moving this to the public API.
    583     @result Returns the default minimum timer interval.
    584 */
    585 + (double)_defaultMinimumTimerInterval;
    586 
    587 /*!
    588     @method setMinimumTimerInterval:
    589     @discussion Sets the minimum interval for DOMTimers in this WebView. This method is
    590     exposed here in the Mac port rather than through WebPreferences (which generally
    591     governs Settings) because this value is something adjusted at run time, not set
    592     globally via "defaults write". Should consider adding this to the public API.
    593     @param intervalInSeconds The new minimum timer interval, in seconds.
    594 */
    595 - (void)_setMinimumTimerInterval:(double)intervalInSeconds;
    596 
    597 /*!
    598     @method _HTTPPipeliningEnabled
    599     @abstract Checks the HTTP pipelining status.
    600     @discussion Defaults to NO.
    601     @result YES if HTTP pipelining is enabled, NO if not enabled.
    602  */
    603 + (BOOL)_HTTPPipeliningEnabled;
    604 
    605 /*!
    606     @method _setHTTPPipeliningEnabled:
    607     @abstract Set the HTTP pipelining status.
    608     @discussion Defaults to NO.
    609     @param enabled The new HTTP pipelining status.
    610  */
    611 + (void)_setHTTPPipeliningEnabled:(BOOL)enabled;
    612 
    613 @end
    614 
    615 @interface WebView (WebViewPrintingPrivate)
    616 /*!
    617     @method _adjustPrintingMarginsForHeaderAndFooter:
    618     @abstract Increase the top and bottom margins for the current print operation to
    619     account for the header and footer height.
    620     @discussion Called by <WebDocument> implementors once when a print job begins. If the
    621     <WebDocument> implementor implements knowsPageRange:, this should be called from there.
    622     Otherwise this should be called from beginDocument. The <WebDocument> implementors need
    623     to also call _drawHeaderAndFooter.
    624 */
    625 - (void)_adjustPrintingMarginsForHeaderAndFooter;
    626 
    627 /*!
    628     @method _drawHeaderAndFooter
    629     @abstract Gives the WebView's UIDelegate a chance to draw a header and footer on the
    630     printed page.
    631     @discussion This should be called by <WebDocument> implementors from an override of
    632     drawPageBorderWithSize:.
    633 */
    634 - (void)_drawHeaderAndFooter;
    635 @end
    636 
    637 @interface WebView (WebViewGrammarChecking)
    638 
    639 // FIXME: These two methods should be merged into WebViewEditing when we're not in API freeze
    640 - (BOOL)isGrammarCheckingEnabled;
    641 #ifndef BUILDING_ON_TIGER
    642 - (void)setGrammarCheckingEnabled:(BOOL)flag;
    643 
    644 // FIXME: This method should be merged into WebIBActions when we're not in API freeze
    645 - (void)toggleGrammarChecking:(id)sender;
    646 #endif
    647 
    648 @end
    649 
    650 @interface WebView (WebViewTextChecking)
    651 
    652 - (BOOL)isAutomaticQuoteSubstitutionEnabled;
    653 - (BOOL)isAutomaticLinkDetectionEnabled;
    654 - (BOOL)isAutomaticDashSubstitutionEnabled;
    655 - (BOOL)isAutomaticTextReplacementEnabled;
    656 - (BOOL)isAutomaticSpellingCorrectionEnabled;
    657 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
    658 - (void)setAutomaticQuoteSubstitutionEnabled:(BOOL)flag;
    659 - (void)toggleAutomaticQuoteSubstitution:(id)sender;
    660 - (void)setAutomaticLinkDetectionEnabled:(BOOL)flag;
    661 - (void)toggleAutomaticLinkDetection:(id)sender;
    662 - (void)setAutomaticDashSubstitutionEnabled:(BOOL)flag;
    663 - (void)toggleAutomaticDashSubstitution:(id)sender;
    664 - (void)setAutomaticTextReplacementEnabled:(BOOL)flag;
    665 - (void)toggleAutomaticTextReplacement:(id)sender;
    666 - (void)setAutomaticSpellingCorrectionEnabled:(BOOL)flag;
    667 - (void)toggleAutomaticSpellingCorrection:(id)sender;
    668 #endif
    669 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
    670 - (void)handleCorrectionPanelResult:(NSString*)result;
    671 #endif
    672 @end
    673 
    674 @interface WebView (WebViewEditingInMail)
    675 - (void)_insertNewlineInQuotedContent;
    676 - (void)_replaceSelectionWithNode:(DOMNode *)node matchStyle:(BOOL)matchStyle;
    677 - (BOOL)_selectionIsCaret;
    678 - (BOOL)_selectionIsAll;
    679 @end
    680 
    681 @interface WebView (WebViewDeviceOrientation)
    682 - (void)_setDeviceOrientationProvider:(id<WebDeviceOrientationProvider>)deviceOrientationProvider;
    683 - (id<WebDeviceOrientationProvider>)_deviceOrientationProvider;
    684 @end
    685 
    686 @protocol WebGeolocationProvider <NSObject>
    687 - (void)registerWebView:(WebView *)webView;
    688 - (void)unregisterWebView:(WebView *)webView;
    689 - (WebGeolocationPosition *)lastPosition;
    690 @end
    691 
    692 @interface WebView (WebViewGeolocation)
    693 - (void)_setGeolocationProvider:(id<WebGeolocationProvider>)locationProvider;
    694 - (id<WebGeolocationProvider>)_geolocationProvider;
    695 
    696 - (void)_geolocationDidChangePosition:(WebGeolocationPosition *)position;
    697 - (void)_geolocationDidFailWithError:(NSError *)error;
    698 @end
    699 
    700 @interface WebView (WebViewPrivateStyleInfo)
    701 - (JSValueRef)_computedStyleIncludingVisitedInfo:(JSContextRef)context forElement:(JSValueRef)value;
    702 @end
    703 
    704 @interface WebView (WebViewPrivateNodesFromRect)
    705 - (JSValueRef)_nodesFromRect:(JSContextRef)context forDocument:(JSValueRef)value x:(int)x  y:(int)y top:(unsigned)top right:(unsigned)right bottom:(unsigned)bottom left:(unsigned)left ignoreClipping:(BOOL)ignoreClipping;
    706 @end
    707 
    708 @interface NSObject (WebFrameLoadDelegatePrivate)
    709 - (void)webView:(WebView *)sender didFirstLayoutInFrame:(WebFrame *)frame;
    710 
    711 // didFinishDocumentLoadForFrame is sent when the document has finished loading, though not necessarily all
    712 // of its subresources.
    713 // FIXME 5259339: Currently this callback is not sent for (some?) pages loaded entirely from the cache.
    714 - (void)webView:(WebView *)sender didFinishDocumentLoadForFrame:(WebFrame *)frame;
    715 
    716 // Addresses 4192534.  SPI for now.
    717 - (void)webView:(WebView *)sender didHandleOnloadEventsForFrame:(WebFrame *)frame;
    718 
    719 - (void)webView:(WebView *)sender didFirstVisuallyNonEmptyLayoutInFrame:(WebFrame *)frame;
    720 
    721 // For implementing the WebInspector's test harness
    722 - (void)webView:(WebView *)webView didClearInspectorWindowObject:(WebScriptObject *)windowObject forFrame:(WebFrame *)frame;
    723 
    724 @end
    725 
    726 @interface NSObject (WebResourceLoadDelegatePrivate)
    727 // Addresses <rdar://problem/5008925> - SPI for now
    728 - (NSCachedURLResponse *)webView:(WebView *)sender resource:(id)identifier willCacheResponse:(NSCachedURLResponse *)response fromDataSource:(WebDataSource *)dataSource;
    729 @end
    730 
    731 #undef WebNSInteger
    732 #undef WebNSUInteger
    733