2 * Copyright (C) 2005-2012 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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 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.
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.
29 #import <WebKitLegacy/WebView.h>
30 #import <WebKitLegacy/WebFramePrivate.h>
31 #import <JavaScriptCore/JSBase.h>
34 #import <CoreGraphics/CGColor.h>
37 #if !defined(ENABLE_DASHBOARD_SUPPORT)
39 #define ENABLE_DASHBOARD_SUPPORT 0
41 #define ENABLE_DASHBOARD_SUPPORT 1
45 #if !defined(ENABLE_REMOTE_INSPECTOR)
46 // FIXME: Should we just remove this ENABLE flag everywhere?
47 #define ENABLE_REMOTE_INSPECTOR 1
52 @class WebDeviceOrientation;
53 @class WebGeolocationPosition;
55 @class WebNotification;
56 @class WebPreferences;
57 @class WebScriptWorld;
58 @class WebSecurityOrigin;
59 @class WebTextIterator;
62 @class WebFixedPositionContent;
64 @protocol WebCaretChangeListener;
66 @protocol WebDeviceOrientationProvider;
67 @protocol WebFormDelegate;
68 @protocol WebUserMediaClient;
71 extern NSString *_WebCanGoBackKey;
72 extern NSString *_WebCanGoForwardKey;
73 extern NSString *_WebEstimatedProgressKey;
74 extern NSString *_WebIsLoadingKey;
75 extern NSString *_WebMainFrameIconKey;
76 extern NSString *_WebMainFrameTitleKey;
77 extern NSString *_WebMainFrameURLKey;
78 extern NSString *_WebMainFrameDocumentKey;
82 extern NSString * const WebViewProgressEstimatedProgressKey;
83 extern NSString * const WebViewProgressBackgroundColorKey;
86 // pending public WebElementDictionary keys
87 extern NSString *WebElementTitleKey; // NSString of the title of the element (used by Safari)
88 extern NSString *WebElementSpellingToolTipKey; // NSString of a tooltip representing misspelling or bad grammar (used internally)
89 extern NSString *WebElementIsContentEditableKey; // NSNumber indicating whether the inner non-shared node is content editable (used internally)
90 extern NSString *WebElementMediaURLKey; // NSURL of the media element
92 // other WebElementDictionary keys
93 extern NSString *WebElementLinkIsLiveKey; // NSNumber of BOOL indicating whether the link is live or not
94 extern NSString *WebElementIsInScrollBarKey;
96 // One of the subviews of the WebView entered compositing mode.
97 extern NSString *_WebViewDidStartAcceleratedCompositingNotification;
99 #if ENABLE_REMOTE_INSPECTOR
100 // FIXME: Legacy, remove this, switch to something from JavaScriptCore Inspector::RemoteInspectorServer.
101 // Notification when the number of inspector sessions becomes non-zero or returns to 0.
102 // Check the current state via -[WebView _hasRemoteInspectorSession].
103 extern NSString *_WebViewRemoteInspectorHasSessionChangedNotification;
107 extern NSString *WebQuickLookFileNameKey;
108 extern NSString *WebQuickLookUTIKey;
111 extern NSString * const WebViewWillCloseNotification;
113 #if ENABLE_DASHBOARD_SUPPORT
115 WebDashboardBehaviorAlwaysSendMouseEventsToAllWindows,
116 WebDashboardBehaviorAlwaysSendActiveNullEventsToPlugIns,
117 WebDashboardBehaviorAlwaysAcceptsFirstMouse,
118 WebDashboardBehaviorAllowWheelScrolling,
119 WebDashboardBehaviorUseBackwardCompatibilityMode
120 } WebDashboardBehavior;
124 WebInjectAtDocumentStart,
125 WebInjectAtDocumentEnd,
126 } WebUserScriptInjectionTime;
129 WebInjectInAllFrames,
130 WebInjectInTopFrameOnly
131 } WebUserContentInjectedFrames;
134 WebFindOptionsCaseInsensitive = 1 << 0,
135 WebFindOptionsAtWordStarts = 1 << 1,
136 WebFindOptionsTreatMedialCapitalAsWordStart = 1 << 2,
137 WebFindOptionsBackwards = 1 << 3,
138 WebFindOptionsWrapAround = 1 << 4,
139 WebFindOptionsStartInSelection = 1 << 5
141 typedef NSUInteger WebFindOptions;
144 WebPaginationModeUnpaginated,
145 WebPaginationModeLeftToRight,
146 WebPaginationModeRightToLeft,
147 WebPaginationModeTopToBottom,
148 WebPaginationModeBottomToTop,
150 // FIXME: Remove these once UIKit has switched to the above.
151 WebPaginationModeHorizontal = WebPaginationModeLeftToRight,
152 WebPaginationModeVertical = WebPaginationModeTopToBottom,
157 WebDidFirstLayout = 1 << 0,
158 WebDidFirstVisuallyNonEmptyLayout = 1 << 1,
159 WebDidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2
161 typedef NSUInteger WebLayoutMilestones;
164 WebPageVisibilityStateVisible,
165 WebPageVisibilityStateHidden,
166 WebPageVisibilityStatePrerender
167 } WebPageVisibilityState;
170 WebNotificationPermissionAllowed,
171 WebNotificationPermissionNotAllowed,
172 WebNotificationPermissionDenied
173 } WebNotificationPermission;
175 #if !TARGET_OS_IPHONE
176 @interface WebController : NSTreeController {
177 IBOutlet WebView *webView;
179 - (WebView *)webView;
180 - (void)setWebView:(WebView *)newWebView;
184 @interface WebView (WebViewEditingActionsPendingPublic)
186 - (void)outdent:(id)sender;
190 @interface WebView (WebPendingPublic)
192 #if !TARGET_OS_IPHONE
193 - (void)scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode;
194 - (void)unscheduleFromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode;
197 - (BOOL)findString:(NSString *)string options:(WebFindOptions)options;
198 - (DOMRange *)DOMRangeOfString:(NSString *)string relativeTo:(DOMRange *)previousRange options:(WebFindOptions)options;
200 - (void)setMainFrameDocumentReady:(BOOL)mainFrameDocumentReady;
202 - (void)setTabKeyCyclesThroughElements:(BOOL)cyclesElements;
203 - (BOOL)tabKeyCyclesThroughElements;
205 - (void)scrollDOMRangeToVisible:(DOMRange *)range;
207 - (void)scrollDOMRangeToVisible:(DOMRange *)range withInset:(CGFloat)inset;
211 @method setScriptDebugDelegate:
212 @abstract Set the WebView's WebScriptDebugDelegate delegate.
213 @param delegate The WebScriptDebugDelegate to set as the delegate.
215 - (void)setScriptDebugDelegate:(id)delegate;
218 @method scriptDebugDelegate
219 @abstract Return the WebView's WebScriptDebugDelegate.
220 @result The WebView's WebScriptDebugDelegate.
222 - (id)scriptDebugDelegate;
225 @method setHistoryDelegate:
226 @abstract Set the WebView's WebHistoryDelegate delegate.
227 @param delegate The WebHistoryDelegate to set as the delegate.
229 - (void)setHistoryDelegate:(id)delegate;
232 @method historyDelegate
233 @abstract Return the WebView's WebHistoryDelegate delegate.
234 @result The WebView's WebHistoryDelegate delegate.
236 - (id)historyDelegate;
240 #if !TARGET_OS_IPHONE
242 @method aeDescByEvaluatingJavaScriptFromString:
243 @param script The text of the JavaScript.
244 @result The result of the script, converted to an NSAppleEventDescriptor, or nil for failure.
246 - (NSAppleEventDescriptor *)aeDescByEvaluatingJavaScriptFromString:(NSString *)script;
249 // Support for displaying multiple text matches.
250 // These methods might end up moving into a protocol, so different document types can specify
251 // whether or not they implement the protocol. For now we'll just deal with HTML.
252 // These methods are still in flux; don't rely on them yet.
253 - (BOOL)canMarkAllTextMatches;
254 - (NSUInteger)countMatchesForText:(NSString *)string options:(WebFindOptions)options highlight:(BOOL)highlight limit:(NSUInteger)limit markMatches:(BOOL)markMatches;
255 - (NSUInteger)countMatchesForText:(NSString *)string inDOMRange:(DOMRange *)range options:(WebFindOptions)options highlight:(BOOL)highlight limit:(NSUInteger)limit markMatches:(BOOL)markMatches;
256 - (void)unmarkAllTextMatches;
257 - (NSArray *)rectsForTextMatches;
259 // Support for disabling registration with the undo manager. This is equivalent to the methods with the same names on NSTextView.
261 - (void)setAllowsUndo:(BOOL)flag;
264 @method setPageSizeMultiplier:
265 @abstract Change the zoom factor of the page in views managed by this webView.
266 @param multiplier A fractional percentage value, 1.0 is 100%.
268 - (void)setPageSizeMultiplier:(float)multiplier;
271 @method pageSizeMultiplier
272 @result The page size multipler.
274 - (float)pageSizeMultiplier;
276 // Commands for doing page zoom. Will end up in WebView (WebIBActions) <NSUserInterfaceValidations>
277 - (BOOL)canZoomPageIn;
278 - (IBAction)zoomPageIn:(id)sender;
279 - (BOOL)canZoomPageOut;
280 - (IBAction)zoomPageOut:(id)sender;
281 - (BOOL)canResetPageZoom;
282 - (IBAction)resetPageZoom:(id)sender;
284 // Sets a master volume control for all media elements in the WebView. Valid values are 0..1.
285 - (void)setMediaVolume:(float)volume;
286 - (float)mediaVolume;
289 - (void)addVisitedLinks:(NSArray *)visitedLinks;
291 - (void)removeVisitedLink:(NSURL *)url;
295 @interface WebView (WebPrivate)
297 - (WebInspector *)inspector;
299 #if ENABLE_REMOTE_INSPECTOR
300 + (void)_enableRemoteInspector;
301 + (void)_disableRemoteInspector;
302 + (void)_disableAutoStartRemoteInspector;
303 + (BOOL)_isRemoteInspectorEnabled;
304 + (BOOL)_hasRemoteInspectorSession;
307 @method allowsRemoteInspection
308 @result Returns whether or not this WebView will allow a Remote Web Inspector
311 - (BOOL)allowsRemoteInspection;
314 @method setAllowsRemoteInspection:
315 @param allow The new permission for this WebView.
316 @abstract Sets the permission of this WebView to either allow or disallow
317 a Remote Web Inspector to attach to it.
319 - (void)setAllowsRemoteInspection:(BOOL)allow;
322 @method setShowingInspectorIndication
323 @param enabled Show the indication when true, hide when false.
324 @abstract indicate this WebView on screen for a remote inspector.
326 - (void)setShowingInspectorIndication:(BOOL)enabled;
330 @method setHostApplicationBundleId:name
331 @param bundleId The application that this WebView was created for.
332 @param name That application's localized display name.
333 @abstract When a WebView is created out of process for an application,
334 you can clarify to a Remote Debugger which application this WebView
335 is intended to belong to; the application which hosts the WebView.
337 - (void)setHostApplicationBundleId:(NSString *)bundleId name:(NSString *)name;
340 @method hostApplicationBundleId
341 @result Returns the host application bundle id.
343 - (NSString *)hostApplicationBundleId;
346 @method hostApplicationName
347 @result Returns the host application name.
349 - (NSString *)hostApplicationName;
352 #endif // ENABLE_REMOTE_INSPECTOR
354 #if !TARGET_OS_IPHONE
356 @method setBackgroundColor:
357 @param backgroundColor Color to use as the default background.
358 @abstract Sets what color the receiver draws under transparent page background colors and images.
359 This color is also used when no page is loaded. A color with alpha should only be used when the receiver is
360 in a non-opaque window, since the color is drawn using NSCompositeCopy.
362 - (void)setBackgroundColor:(NSColor *)backgroundColor;
365 @method backgroundColor
366 @result Returns the background color drawn under transparent page background colors and images.
367 This color is also used when no page is loaded. A color with alpha should only be used when the receiver is
368 in a non-opaque window, since the color is drawn using NSCompositeCopy.
370 - (NSColor *)backgroundColor;
372 - (void)setBackgroundColor:(CGColorRef)backgroundColor;
373 - (CGColorRef)backgroundColor;
377 Could be worth adding to the API.
378 @method _loadBackForwardListFromOtherView:
379 @abstract Loads the view with the contents of the other view, including its backforward list.
380 @param otherView The WebView from which to copy contents.
382 - (void)_loadBackForwardListFromOtherView:(WebView *)otherView;
385 @method _reportException:inContext:
386 @abstract Logs the exception to the Web Inspector. This only needs called for exceptions that
387 occur while using the JavaScriptCore APIs with a context owned by a WebKit.
388 @param exception The exception value to log.
389 @param context The context the exception occured in.
391 + (void)_reportException:(JSValueRef)exception inContext:(JSContextRef)context;
394 @method _dispatchPendingLoadRequests:
395 @abstract Dispatches any pending load requests that have been scheduled because of recent DOM additions or style changes.
396 @discussion You only need to call this method if you require synchronous notification of loads through the resource load delegate.
397 Otherwise the resource load delegate will be notified about loads during a future run loop iteration.
399 - (void)_dispatchPendingLoadRequests;
401 #if !TARGET_OS_IPHONE
402 + (NSArray *)_supportedFileExtensions;
407 @abstract Checks if the WebKit can show the content of the file at the specified path.
408 @param path The path of the file to check
409 @result YES if the WebKit can show the content of the file at the specified path.
411 + (BOOL)canShowFile:(NSString *)path;
413 #if !TARGET_OS_IPHONE
415 @method suggestedFileExtensionForMIMEType:
416 @param MIMEType The MIME type to check.
417 @result The extension based on the MIME type
419 + (NSString *)suggestedFileExtensionForMIMEType: (NSString *)MIMEType;
422 + (NSString *)_standardUserAgentWithApplicationName:(NSString *)applicationName;
424 - (void)_setBrowserUserAgentProductVersion:(NSString *)productVersion buildVersion:(NSString *)buildVersion bundleVersion:(NSString *)bundleVersion;
425 - (void)_setUIWebViewUserAgentWithBuildVersion:(NSString *)buildVersion;
429 @method canCloseAllWebViews
430 @abstract Checks if all the open WebViews can be closed (by dispatching the beforeUnload event to the pages).
431 @result YES if all the WebViews can be closed.
433 + (BOOL)canCloseAllWebViews;
436 - (id)initSimpleHTMLDocumentWithStyle:(NSString *)style frame:(CGRect)frame preferences:(WebPreferences *)preferences groupName:(NSString *)groupName;
437 - (id)_formDelegateForwarder;
438 - (id)_formDelegateForSelector:(SEL)selector;
439 - (id)_webMailDelegate;
440 - (void)setWebMailDelegate:(id)delegate;
441 - (id <WebCaretChangeListener>)caretChangeListener;
442 - (void)setCaretChangeListener:(id <WebCaretChangeListener>)listener;
444 - (NSSet *)caretChangeListeners;
445 - (void)addCaretChangeListener:(id <WebCaretChangeListener>)listener;
446 - (void)removeCaretChangeListener:(id <WebCaretChangeListener>)listener;
447 - (void)removeAllCaretChangeListeners;
449 - (void)caretChanged;
451 - (void)_dispatchUnloadEvent;
453 - (DOMCSSStyleDeclaration *)styleAtSelectionStart;
455 - (NSUInteger)_renderTreeSize;
458 * @method _handleMemoryWarning
459 * @discussion Try to release memory since we got a memory warning from the system. This method is
460 * also used by other internal clients. See <rdar://9582500>.
462 + (void)_handleMemoryWarning;
464 - (void)_setResourceLoadSchedulerSuspended:(BOOL)suspend;
465 + (void)_setTileCacheLayerPoolCapacity:(unsigned)capacity;
467 + (void)_setAcceleratedImageDecoding:(BOOL)enabled;
468 + (BOOL)_acceleratedImageDecoding;
469 + (void)_setAllowCookies:(BOOL)allow;
470 + (BOOL)_allowCookies;
471 + (BOOL)_isUnderMemoryPressure;
472 + (void)_clearMemoryPressure;
473 + (BOOL)_shouldWaitForMemoryClearMessage;
474 + (void)_releaseMemoryNow;
475 + (void)_clearPrivateBrowsingSessionCookieStorage;
477 - (void)_replaceCurrentHistoryItem:(WebHistoryItem *)item;
478 #endif // PLATFORM(IOS)
481 - (NSDictionary *)quickLookContentForURL:(NSURL *)url;
484 // May well become public
485 - (void)_setFormDelegate:(id<WebFormDelegate>)delegate;
486 - (id<WebFormDelegate>)_formDelegate;
490 // _close is now replaced by public method -close. It remains here only for backward compatibility
491 // until callers can be weaned off of it.
494 // Indicates if the WebView is in the midst of a user gesture.
495 - (BOOL)_isProcessingUserGesture;
497 // Determining and updating page visibility state.
498 - (BOOL)_isViewVisible;
499 - (void)_updateVisibilityState;
501 // SPI for DumpRenderTree
502 - (void)_updateActiveState;
505 @method _registerViewClass:representationClass:forURLScheme:
506 @discussion Register classes that implement WebDocumentView and WebDocumentRepresentation respectively.
507 @param viewClass The WebDocumentView class to use to render data for a given MIME type.
508 @param representationClass The WebDocumentRepresentation class to use to represent data of the given MIME type.
509 @param scheme The URL scheme to represent with an object of the given class.
511 + (void)_registerViewClass:(Class)viewClass representationClass:(Class)representationClass forURLScheme:(NSString *)URLScheme;
513 + (void)_unregisterViewClassAndRepresentationClassForMIMEType:(NSString *)MIMEType;
516 @method _canHandleRequest:
517 @abstract Performs a "preflight" operation that performs some
518 speculative checks to see if a request can be used to create
519 a WebDocumentView and WebDocumentRepresentation.
520 @discussion The result of this method is valid only as long as no
521 protocols or schemes are registered or unregistered, and as long as
522 the request is not mutated (if the request is mutable). Hence, clients
523 should be prepared to handle failures even if they have performed request
524 preflighting by caling this method.
525 @param request The request to preflight.
526 @result YES if it is likely that a WebDocumentView and WebDocumentRepresentation
527 can be created for the request, NO otherwise.
529 + (BOOL)_canHandleRequest:(NSURLRequest *)request;
531 + (NSString *)_decodeData:(NSData *)data;
533 + (void)_setAlwaysUsesComplexTextCodePath:(BOOL)f;
534 #if !TARGET_OS_IPHONE
535 // This is the old name of the above method. Needed for Safari versions that call it.
536 + (void)_setAlwaysUseATSU:(BOOL)f;
539 + (void)_setAllowsRoundingHacks:(BOOL)allowsRoundingHacks;
540 + (BOOL)_allowsRoundingHacks;
542 #if !TARGET_OS_IPHONE
543 - (NSCachedURLResponse *)_cachedResponseForURL:(NSURL *)URL;
546 #if ENABLE_DASHBOARD_SUPPORT
547 - (void)_addScrollerDashboardRegions:(NSMutableDictionary *)regions;
548 - (NSDictionary *)_dashboardRegions;
550 - (void)_setDashboardBehavior:(WebDashboardBehavior)behavior to:(BOOL)flag;
551 - (BOOL)_dashboardBehavior:(WebDashboardBehavior)behavior;
554 + (void)_setShouldUseFontSmoothing:(BOOL)f;
555 + (BOOL)_shouldUseFontSmoothing;
557 #if !TARGET_OS_IPHONE
558 // These two methods are useful for a test harness that needs a consistent appearance for the focus rings
559 // regardless of OS X version.
560 + (void)_setUsesTestModeFocusRingColor:(BOOL)f;
561 + (BOOL)_usesTestModeFocusRingColor;
565 - (void)_setUIKitDelegate:(id)delegate;
566 - (id)_UIKitDelegate;
567 - (void)_clearDelegates;
569 - (NSURL *)_displayURL;
571 + (NSArray *)_productivityDocumentMIMETypes;
573 - (void)_setAllowsMessaging:(BOOL)aFlag;
574 - (BOOL)_allowsMessaging;
576 - (void)_setCustomFixedPositionLayoutRectInWebThread:(CGRect)rect synchronize:(BOOL)synchronize;
577 - (void)_setCustomFixedPositionLayoutRect:(CGRect)rect;
579 - (WebFixedPositionContent*)_fixedPositionContent;
581 - (void)_viewGeometryDidChange;
582 - (void)_overflowScrollPositionChangedTo:(CGPoint)offset forNode:(DOMNode *)node isUserScroll:(BOOL)userScroll;
584 - (NSArray *)_touchEventRegions;
587 @method _doNotStartObservingNetworkReachability
588 @abstract Does not start observation of network reachability in any WebView.
589 @discussion To take effect, this method must be called before the first WebView is created.
591 + (void)_doNotStartObservingNetworkReachability;
594 #if !TARGET_OS_IPHONE
596 @method setAlwaysShowVerticalScroller:
597 @result Forces the vertical scroller to be visible if flag is YES, otherwise
598 if flag is NO the scroller with automatically show and hide as needed.
600 - (void)setAlwaysShowVerticalScroller:(BOOL)flag;
603 @method alwaysShowVerticalScroller
604 @result YES if the vertical scroller is always shown
606 - (BOOL)alwaysShowVerticalScroller;
609 @method setAlwaysShowHorizontalScroller:
610 @result Forces the horizontal scroller to be visible if flag is YES, otherwise
611 if flag is NO the scroller with automatically show and hide as needed.
613 - (void)setAlwaysShowHorizontalScroller:(BOOL)flag;
616 @method alwaysShowHorizontalScroller
617 @result YES if the horizontal scroller is always shown
619 - (BOOL)alwaysShowHorizontalScroller;
622 @method setProhibitsMainFrameScrolling:
623 @abstract Prohibits scrolling in the WebView's main frame. Used to "lock" a WebView
624 to a specific scroll position.
626 - (void)setProhibitsMainFrameScrolling:(BOOL)prohibits;
629 @method _setAdditionalWebPlugInPaths:
630 @abstract Sets additional plugin search paths for a specific WebView.
632 - (void)_setAdditionalWebPlugInPaths:(NSArray *)newPaths;
633 #endif /* !TARGET_OS_IPHONE */
637 @method _pluginsAreRunning
638 @result Returns YES if any plug-ins in the WebView are running.
640 - (BOOL)_pluginsAreRunning;
642 @method _destroyAllPlugIns
643 @abstract Destroys all plug-ins in all of the WebView's frames.
645 - (void)_destroyAllPlugIns;
647 @method _startAllPlugIns
648 @abstract Starts all plug-ins in all of the WebView's frames.
650 - (void)_startAllPlugIns;
652 @method _stopAllPlugIns
653 @abstract Stops all plug-ins in all of the WebView's frames.
655 - (void)_stopAllPlugIns;
657 @method _stopAllPlugInsForPageCache
658 @abstract Stops all plug-ins in all of the WebView's frames.
659 Called when the page is entering the PageCache and lets the
660 plug-in know this by sending -webPlugInStopForPageCache.
662 - (void)_stopAllPlugInsForPageCache;
664 @method _restorePlugInsFromCache
665 @abstract Reconnects plug-ins from all of the WebView's frames to the
666 WebView and performs any other necessary reinitialization.
668 - (void)_restorePlugInsFromCache;
671 @method _setMediaLayer:forPluginView:
672 @abstract Set the layer that renders plug-in content for the given pluginView.
673 If layer is NULL, removes any existing layer. Returns YES if the set or
674 remove was successful.
676 - (BOOL)_setMediaLayer:(CALayer*)layer forPluginView:(NSView*)pluginView;
679 @method _clearBackForwardCache
680 @abstract Clear's this WebView's back/forward cache on the WebThread.
682 - (void)_clearBackForwardCache;
685 @method _wantsTelephoneNumberParsing
686 @abstract Does this WebView want phone number parsing? (This could ultimately be disallowed by the document itself).
689 - (BOOL)_wantsTelephoneNumberParsing;
692 @method _setWantsTelephoneNumberParsing
693 @abstract Explicitly disable WebKit phone number parsing on this WebView, or say that you want it enabled if possible.
696 - (void)_setWantsTelephoneNumberParsing:(BOOL)flag;
699 @method _setNeedsUnrestrictedGetMatchedCSSRules
700 @abstract Explicitly enables/disables cross origin CSS rules matching.
702 - (void)_setNeedsUnrestrictedGetMatchedCSSRules:(BOOL)flag;
703 #endif /* TARGET_OS_IPHONE */
706 @method _attachScriptDebuggerToAllFrames
707 @abstract Attaches a script debugger to all frames belonging to the receiver.
709 - (void)_attachScriptDebuggerToAllFrames;
712 @method _detachScriptDebuggerFromAllFrames
713 @abstract Detaches any script debuggers from all frames belonging to the receiver.
715 - (void)_detachScriptDebuggerFromAllFrames;
717 - (BOOL)defersCallbacks; // called by QuickTime plug-in
718 - (void)setDefersCallbacks:(BOOL)defer; // called by QuickTime plug-in
720 - (BOOL)usesPageCache;
721 - (void)setUsesPageCache:(BOOL)usesPageCache;
723 - (WebHistoryItem *)_globalHistoryItem;
726 @method textIteratorForRect:
727 @param rect The rectangle of the document that we're interested in text from.
728 @result WebTextIterator object, initialized with a range that corresponds to
729 the passed-in rectangle.
730 @abstract This method gives the text for the approximate range of the document
731 corresponding to the rectangle. The range is determined by using hit testing at
732 the top left and bottom right of the rectangle. Because of that, there can be
733 text visible in the rectangle that is not included in the iterator. If you need
734 a guarantee of iterating all text that is visible, then you need to instead make
735 a WebTextIterator with a DOMRange that covers the entire document.
737 - (WebTextIterator *)textIteratorForRect:(NSRect)rect;
739 #if ENABLE_DASHBOARD_SUPPORT
740 // <rdar://problem/5217124> Clients other than Dashboard, don't use this.
741 // As of this writing, Dashboard uses this on Tiger, but not on Leopard or newer.
742 - (void)handleAuthenticationForResource:(id)identifier challenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource;
745 #if !TARGET_OS_IPHONE
746 - (void)_clearUndoRedoOperations;
749 /* Used to do fast (lower quality) scaling of images so that window resize can be quick. */
750 - (BOOL)_inFastImageScalingMode;
751 - (void)_setUseFastImageScalingMode:(BOOL)flag;
753 - (BOOL)_cookieEnabled;
754 - (void)_setCookieEnabled:(BOOL)enable;
756 // SPI for DumpRenderTree
757 - (void)_executeCoreCommandByName:(NSString *)name value:(NSString *)value;
758 - (void)_clearMainFrameName;
760 - (void)setSelectTrailingWhitespaceEnabled:(BOOL)flag;
761 - (BOOL)isSelectTrailingWhitespaceEnabled;
763 - (void)setMemoryCacheDelegateCallsEnabled:(BOOL)suspend;
764 - (BOOL)areMemoryCacheDelegateCallsEnabled;
766 #if !TARGET_OS_IPHONE
767 + (NSCursor *)_pointingHandCursor;
770 // SPI for DumpRenderTree
771 - (BOOL)_postsAcceleratedCompositingNotifications;
772 - (void)_setPostsAcceleratedCompositingNotifications:(BOOL)flag;
773 - (BOOL)_isUsingAcceleratedCompositing;
774 - (void)_setBaseCTM:(CGAffineTransform)transform forContext:(CGContextRef)context;
776 // For DumpRenderTree
777 - (BOOL)interactiveFormValidationEnabled;
778 - (void)setInteractiveFormValidationEnabled:(BOOL)enabled;
779 - (int)validationMessageTimerMagnification;
780 - (void)setValidationMessageTimerMagnification:(int)newValue;
782 // Returns YES if NSView -displayRectIgnoringOpacity:inContext: will produce a faithful representation of the content.
783 - (BOOL)_isSoftwareRenderable;
784 // When drawing into a bitmap context, we normally flatten compositing layers (and distort 3D transforms).
785 // Clients who are able to capture their own copy of the compositing layers need to be able to disable this.
786 - (void)_setIncludesFlattenedCompositingLayersWhenDrawingToBitmap:(BOOL)flag;
787 - (BOOL)_includesFlattenedCompositingLayersWhenDrawingToBitmap;
789 - (void)setTracksRepaints:(BOOL)flag;
790 - (BOOL)isTrackingRepaints;
791 - (void)resetTrackedRepaints;
792 - (NSArray*)trackedRepaintRects; // Returned array contains rectValue NSValues.
794 #if !TARGET_OS_IPHONE
795 // Which pasteboard text is coming from in editing delegate methods such as shouldInsertNode.
796 - (NSPasteboard *)_insertionPasteboard;
799 // Whitelists access from an origin (sourceOrigin) to a set of one or more origins described by the parameters:
800 // - destinationProtocol: The protocol to grant access to.
801 // - destinationHost: The host to grant access to.
802 // - allowDestinationSubdomains: If host is a domain, setting this to YES will whitelist host and all its subdomains, recursively.
803 + (void)_addOriginAccessWhitelistEntryWithSourceOrigin:(NSString *)sourceOrigin destinationProtocol:(NSString *)destinationProtocol destinationHost:(NSString *)destinationHost allowDestinationSubdomains:(BOOL)allowDestinationSubdomains;
804 + (void)_removeOriginAccessWhitelistEntryWithSourceOrigin:(NSString *)sourceOrigin destinationProtocol:(NSString *)destinationProtocol destinationHost:(NSString *)destinationHost allowDestinationSubdomains:(BOOL)allowDestinationSubdomains;
806 // Removes all white list entries created with _addOriginAccessWhitelistEntryWithSourceOrigin.
807 + (void)_resetOriginAccessWhitelists;
809 // 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.
810 + (void)_addUserScriptToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectionTime:(WebUserScriptInjectionTime)injectionTime;
811 + (void)_addUserStyleSheetToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist;
813 + (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;
814 + (void)_addUserStyleSheetToGroup:(NSString *)groupName world:(WebScriptWorld *)world source:(NSString *)source url:(NSURL *)url whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectedFrames:(WebUserContentInjectedFrames)injectedFrames;
815 + (void)_removeUserScriptFromGroup:(NSString *)groupName world:(WebScriptWorld *)world url:(NSURL *)url;
816 + (void)_removeUserStyleSheetFromGroup:(NSString *)groupName world:(WebScriptWorld *)world url:(NSURL *)url;
817 + (void)_removeUserScriptsFromGroup:(NSString *)groupName world:(WebScriptWorld *)world;
818 + (void)_removeUserStyleSheetsFromGroup:(NSString *)groupName world:(WebScriptWorld *)world;
819 + (void)_removeAllUserContentFromGroup:(NSString *)groupName;
821 // SPI for DumpRenderTree
822 + (void)_setLoadResourcesSerially:(BOOL)serialize;
825 @method cssAnimationsSuspended
826 @abstract Returns whether or not CSS Animations are suspended.
827 @result YES if CSS Animations are suspended.
829 - (BOOL)cssAnimationsSuspended;
832 @method setCSSAnimationsSuspended
833 @param paused YES to suspend animations, NO to resume animations.
834 @discussion Suspends or resumes all running animations and transitions in the page.
836 - (void)setCSSAnimationsSuspended:(BOOL)suspended;
839 SPI to revert back to buggy behavior that would allow new transitions
840 and animations to run even when the view is suspended (e.g. loading a
843 - (BOOL)allowsNewCSSAnimationsWhileSuspended;
844 - (void)setAllowsNewCSSAnimationsWhileSuspended:(BOOL)allowed;
846 + (void)_setDomainRelaxationForbidden:(BOOL)forbidden forURLScheme:(NSString *)scheme;
847 + (void)_registerURLSchemeAsSecure:(NSString *)scheme;
848 + (void)_registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing:(NSString *)scheme;
849 + (void)_registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing:(NSString *)scheme;
851 - (void)_scaleWebView:(float)scale atOrigin:(NSPoint)origin;
852 - (float)_viewScaleFactor;
854 - (void)_setUseFixedLayout:(BOOL)fixed;
855 - (void)_setFixedLayoutSize:(NSSize)size;
857 - (BOOL)_useFixedLayout;
858 - (NSSize)_fixedLayoutSize;
860 - (void)_setPaginationMode:(WebPaginationMode)paginationMode;
861 - (WebPaginationMode)_paginationMode;
863 - (void)_listenForLayoutMilestones:(WebLayoutMilestones)layoutMilestones;
864 - (WebLayoutMilestones)_layoutMilestones;
866 - (WebPageVisibilityState)_visibilityState;
867 - (void)_setVisibilityState:(WebPageVisibilityState)visibilityState isInitialState:(BOOL)isInitialState;
869 // Whether the column-break-{before,after} properties are respected instead of the
870 // page-break-{before,after} properties.
871 - (void)_setPaginationBehavesLikeColumns:(BOOL)behavesLikeColumns;
872 - (BOOL)_paginationBehavesLikeColumns;
874 // Set to 0 to have the page length equal the view length.
875 - (void)_setPageLength:(CGFloat)pageLength;
876 - (CGFloat)_pageLength;
877 - (void)_setGapBetweenPages:(CGFloat)pageGap;
878 - (CGFloat)_gapBetweenPages;
879 - (NSUInteger)_pageCount;
881 #if !TARGET_OS_IPHONE
882 - (void)_setCustomBackingScaleFactor:(CGFloat)overrideScaleFactor;
883 - (CGFloat)_backingScaleFactor;
886 // Deprecated. Use the methods in pending public above instead.
887 - (NSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit;
888 - (NSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit markMatches:(BOOL)markMatches;
891 @method searchFor:direction:caseSensitive:wrap:startInSelection:
892 @abstract Searches a document view for a string and highlights the string if it is found.
893 Starts the search from the current selection. Will search across all frames.
894 @param string The string to search for.
895 @param forward YES to search forward, NO to seach backwards.
896 @param caseFlag YES to for case-sensitive search, NO for case-insensitive search.
897 @param wrapFlag YES to wrap around, NO to avoid wrapping.
898 @param startInSelection YES to begin search in the selected text (useful for incremental searching), NO to begin search after the selected text.
899 @result YES if found, NO if not found.
901 // Deprecated. Use findString.
902 - (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag startInSelection:(BOOL)startInSelection;
905 @method _HTTPPipeliningEnabled
906 @abstract Checks the HTTP pipelining status.
907 @discussion Defaults to NO.
908 @result YES if HTTP pipelining is enabled, NO if not enabled.
910 + (BOOL)_HTTPPipeliningEnabled;
913 @method _setHTTPPipeliningEnabled:
914 @abstract Set the HTTP pipelining status.
915 @discussion Defaults to NO.
916 @param enabled The new HTTP pipelining status.
918 + (void)_setHTTPPipeliningEnabled:(BOOL)enabled;
920 @property (nonatomic, copy, getter=_sourceApplicationAuditData, setter=_setSourceApplicationAuditData:) NSData *sourceApplicationAuditData;
922 - (void)_setFontFallbackPrefersPictographs:(BOOL)flag;
926 #if !TARGET_OS_IPHONE
927 @interface WebView (WebViewPrintingPrivate)
929 @method _adjustPrintingMarginsForHeaderAndFooter:
930 @abstract Increase the top and bottom margins for the current print operation to
931 account for the header and footer height.
932 @discussion Called by <WebDocument> implementors once when a print job begins. If the
933 <WebDocument> implementor implements knowsPageRange:, this should be called from there.
934 Otherwise this should be called from beginDocument. The <WebDocument> implementors need
935 to also call _drawHeaderAndFooter.
937 - (void)_adjustPrintingMarginsForHeaderAndFooter;
940 @method _drawHeaderAndFooter
941 @abstract Gives the WebView's UIDelegate a chance to draw a header and footer on the
943 @discussion This should be called by <WebDocument> implementors from an override of
944 drawPageBorderWithSize:.
946 - (void)_drawHeaderAndFooter;
949 @interface WebView (WebViewGrammarChecking)
951 // FIXME: These two methods should be merged into WebViewEditing when we're not in API freeze
952 - (BOOL)isGrammarCheckingEnabled;
953 - (void)setGrammarCheckingEnabled:(BOOL)flag;
955 // FIXME: This method should be merged into WebIBActions when we're not in API freeze
956 - (void)toggleGrammarChecking:(id)sender;
960 @interface WebView (WebViewTextChecking)
962 - (BOOL)isAutomaticQuoteSubstitutionEnabled;
963 - (BOOL)isAutomaticLinkDetectionEnabled;
964 - (BOOL)isAutomaticDashSubstitutionEnabled;
965 - (BOOL)isAutomaticTextReplacementEnabled;
966 - (BOOL)isAutomaticSpellingCorrectionEnabled;
967 - (void)setAutomaticQuoteSubstitutionEnabled:(BOOL)flag;
968 - (void)toggleAutomaticQuoteSubstitution:(id)sender;
969 - (void)setAutomaticLinkDetectionEnabled:(BOOL)flag;
970 - (void)toggleAutomaticLinkDetection:(id)sender;
971 - (void)setAutomaticDashSubstitutionEnabled:(BOOL)flag;
972 - (void)toggleAutomaticDashSubstitution:(id)sender;
973 - (void)setAutomaticTextReplacementEnabled:(BOOL)flag;
974 - (void)toggleAutomaticTextReplacement:(id)sender;
975 - (void)setAutomaticSpellingCorrectionEnabled:(BOOL)flag;
976 - (void)toggleAutomaticSpellingCorrection:(id)sender;
978 #endif /* !TARGET_OS_IPHONE */
980 @interface WebView (WebViewEditingInMail)
981 - (void)_insertNewlineInQuotedContent;
982 - (void)_replaceSelectionWithNode:(DOMNode *)node matchStyle:(BOOL)matchStyle;
983 - (BOOL)_selectionIsCaret;
984 - (BOOL)_selectionIsAll;
985 - (void)_simplifyMarkup:(DOMNode *)startNode endNode:(DOMNode *)endNode;
989 @interface WebView (WebViewDeviceOrientation)
990 - (void)_setDeviceOrientationProvider:(id<WebDeviceOrientationProvider>)deviceOrientationProvider;
991 - (id<WebDeviceOrientationProvider>)_deviceOrientationProvider;
995 @protocol WebGeolocationProvider;
997 @protocol WebGeolocationProviderInitializationListener <NSObject>
998 - (void)initializationAllowedWebView:(WebView *)webView provider:(id<WebGeolocationProvider>)provider;
999 - (void)initializationDeniedWebView:(WebView *)webView provider:(id<WebGeolocationProvider>)provider;
1003 @interface WebView (WebViewUserMedia)
1004 - (void)_setUserMediaClient:(id<WebUserMediaClient>)userMediaClient;
1005 - (id<WebUserMediaClient>)_userMediaClient;
1008 @protocol WebGeolocationProvider <NSObject>
1009 - (void)registerWebView:(WebView *)webView;
1010 - (void)unregisterWebView:(WebView *)webView;
1011 - (WebGeolocationPosition *)lastPosition;
1012 #if TARGET_OS_IPHONE
1013 - (void)setEnableHighAccuracy:(BOOL)enableHighAccuracy;
1014 - (void)initializeGeolocationForWebView:(WebView *)webView listener:(id<WebGeolocationProviderInitializationListener>)listener;
1015 - (void)cancelWarmUpForWebView:(WebView *)webView;
1016 - (void)stopTrackingWebView:(WebView *)webView;
1020 @protocol WebNotificationProvider
1021 - (void)registerWebView:(WebView *)webView;
1022 - (void)unregisterWebView:(WebView *)webView;
1024 - (void)showNotification:(WebNotification *)notification fromWebView:(WebView *)webView;
1025 - (void)cancelNotification:(WebNotification *)notification;
1026 - (void)notificationDestroyed:(WebNotification *)notification;
1027 - (void)clearNotifications:(NSArray *)notificationIDs;
1028 - (WebNotificationPermission)policyForOrigin:(WebSecurityOrigin *)origin;
1030 - (void)webView:(WebView *)webView didShowNotification:(uint64_t)notificationID;
1031 - (void)webView:(WebView *)webView didClickNotification:(uint64_t)notificationID;
1032 - (void)webView:(WebView *)webView didCloseNotifications:(NSArray *)notificationIDs;
1035 @interface WebView (WebViewGeolocation)
1036 - (void)_setGeolocationProvider:(id<WebGeolocationProvider>)locationProvider;
1037 - (id<WebGeolocationProvider>)_geolocationProvider;
1039 - (void)_geolocationDidChangePosition:(WebGeolocationPosition *)position;
1040 - (void)_geolocationDidFailWithMessage:(NSString *)errorMessage;
1041 #if TARGET_OS_IPHONE
1042 - (void)_resetAllGeolocationPermission;
1046 @interface WebView (WebViewNotification)
1047 - (void)_setNotificationProvider:(id<WebNotificationProvider>)notificationProvider;
1048 - (id<WebNotificationProvider>)_notificationProvider;
1050 - (void)_notificationDidShow:(uint64_t)notificationID;
1051 - (void)_notificationDidClick:(uint64_t)notificationID;
1052 - (void)_notificationsDidClose:(NSArray *)notificationIDs;
1054 - (uint64_t)_notificationIDForTesting:(JSValueRef)jsNotification;
1057 #if TARGET_OS_IPHONE
1058 @interface WebView (WebViewIOSPDF)
1059 + (Class)_getPDFRepresentationClass;
1060 + (void)_setPDFRepresentationClass:(Class)pdfRepresentationClass;
1062 + (Class)_getPDFViewClass;
1063 + (void)_setPDFViewClass:(Class)pdfViewClass;
1067 @interface NSObject (WebViewFrameLoadDelegatePrivate)
1068 - (void)webView:(WebView *)sender didFirstLayoutInFrame:(WebFrame *)frame;
1070 // didFinishDocumentLoadForFrame is sent when the document has finished loading, though not necessarily all
1071 // of its subresources.
1072 // FIXME 5259339: Currently this callback is not sent for (some?) pages loaded entirely from the cache.
1073 - (void)webView:(WebView *)sender didFinishDocumentLoadForFrame:(WebFrame *)frame;
1075 // Addresses 4192534. SPI for now.
1076 - (void)webView:(WebView *)sender didHandleOnloadEventsForFrame:(WebFrame *)frame;
1078 - (void)webView:(WebView *)sender didFirstVisuallyNonEmptyLayoutInFrame:(WebFrame *)frame;
1080 - (void)webView:(WebView *)sender didLayout:(WebLayoutMilestones)milestones;
1082 // For implementing the WebInspector's test harness
1083 - (void)webView:(WebView *)webView didClearInspectorWindowObject:(WebScriptObject *)windowObject forFrame:(WebFrame *)frame;
1087 @interface NSObject (WebViewResourceLoadDelegatePrivate)
1088 // Addresses <rdar://problem/5008925> - SPI for now
1089 - (NSCachedURLResponse *)webView:(WebView *)sender resource:(id)identifier willCacheResponse:(NSCachedURLResponse *)response fromDataSource:(WebDataSource *)dataSource;
1096 // This is a C function to avoid calling +[WebView initialize].
1097 void WebInstallMemoryPressureHandler(void);