Enable -Wcast-qual for WebInspectorUI, WebKitLegacy, WebKit projects
[WebKit-https.git] / Source / WebKitLegacy / mac / WebView / WebViewInternal.h
1 /*
2  * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3  * Copyright (C) 2010 Igalia S.L
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1.  Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer. 
11  * 2.  Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution. 
14  * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
15  *     its contributors may be used to endorse or promote products derived
16  *     from this software without specific prior written permission. 
17  *
18  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30 // This header contains WebView declarations that can be used anywhere in WebKit, but are neither SPI nor API.
31
32 #import "WebPreferences.h"
33 #import "WebViewPrivate.h"
34 #import "WebTypesInternal.h"
35
36 #ifdef __cplusplus
37 #import <WebCore/AlternativeTextClient.h>
38 #import <WebCore/FindOptions.h>
39 #import <WebCore/FloatRect.h>
40 #import <WebCore/HTMLMediaElementEnums.h>
41 #import <WebCore/LayoutMilestones.h>
42 #import <WebCore/TextAlternativeWithRange.h>
43 #import <WebCore/TextIndicator.h>
44 #import <WebCore/TextIndicatorWindow.h>
45 #import <WebCore/WebCoreKeyboardUIMode.h>
46 #import <functional>
47 #import <wtf/Forward.h>
48 #import <wtf/RetainPtr.h>
49
50 namespace WebCore {
51 class Element;
52 class Event;
53 class Frame;
54 class HTMLMediaElement;
55 class HTMLVideoElement;
56 class HistoryItem;
57 class KeyboardEvent;
58 class Page;
59 class RenderBox;
60 class TextIndicator;
61 class URL;
62 struct DictationAlternative;
63 struct DictionaryPopupInfo;
64 }
65
66 #if PLATFORM(IOS) && ENABLE(DRAG_SUPPORT)
67 namespace WebCore {
68 struct DragItem;
69 }
70 #endif
71
72 class WebMediaPlaybackTargetPicker;
73 class WebSelectionServiceController;
74
75 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS)
76 #import <WebCore/MediaPlaybackTargetContext.h>
77 #import <WebCore/MediaProducer.h>
78 #endif
79
80 #endif
81
82 @class NSCandidateListTouchBarItem;
83 @class WebBasePluginPackage;
84 @class WebDownload;
85 @class WebImmediateActionController;
86 @class WebNodeHighlight;
87
88 #ifdef __cplusplus
89
90 WebCore::FindOptions coreOptions(WebFindOptions options);
91
92 WebCore::LayoutMilestones coreLayoutMilestones(WebLayoutMilestones);
93 WebLayoutMilestones kitLayoutMilestones(WebCore::LayoutMilestones);
94
95 #if USE(DICTATION_ALTERNATIVES)
96 OBJC_CLASS NSTextAlternatives;
97 #endif
98
99 #if ENABLE(DATA_INTERACTION) && defined(__cplusplus)
100 @interface WebUITextIndicatorData (WebUITextIndicatorInternal)
101 - (WebUITextIndicatorData *)initWithImage:(CGImageRef)image textIndicatorData:(const WebCore::TextIndicatorData&)indicatorData scale:(CGFloat)scale;
102 - (WebUITextIndicatorData *)initWithImage:(CGImageRef)image scale:(CGFloat)scale;
103 @end
104 #endif
105
106 @interface WebView (WebViewEditingExtras)
107 - (BOOL)_shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag;
108 @end
109
110 @interface WebView (AllWebViews)
111 + (void)_makeAllWebViewsPerformSelector:(SEL)selector;
112 - (void)_removeFromAllWebViewsSet;
113 - (void)_addToAllWebViewsSet;
114 @end
115
116 @interface WebView (WebViewInternal)
117
118 + (BOOL)shouldIncludeInWebKitStatistics;
119
120 - (WebCore::Frame*)_mainCoreFrame;
121 - (WebFrame *)_selectedOrMainFrame;
122
123 - (void)_clearCredentials;
124
125 - (WebCore::KeyboardUIMode)_keyboardUIMode;
126
127 - (BOOL)_becomingFirstResponderFromOutside;
128
129 - (BOOL)_needsOneShotDrawingSynchronization;
130 - (void)_setNeedsOneShotDrawingSynchronization:(BOOL)needsSynchronization;
131 - (void)_scheduleCompositingLayerFlush;
132 - (BOOL)_flushCompositingChanges;
133
134 #if USE(AUTOCORRECTION_PANEL)
135 - (void)handleAcceptedAlternativeText:(NSString*)text;
136 #endif
137
138 #if USE(DICTATION_ALTERNATIVES)
139 - (void)_getWebCoreDictationAlternatives:(Vector<WebCore::DictationAlternative>&)alternatives fromTextAlternatives:(const Vector<WebCore::TextAlternativeWithRange>&)alternativesWithRange;
140 - (void)_showDictationAlternativeUI:(const WebCore::FloatRect&)boundingBoxOfDictatedText forDictationContext:(uint64_t)dictationContext;
141 - (void)_removeDictationAlternatives:(uint64_t)dictationContext;
142 - (Vector<String>)_dictationAlternatives:(uint64_t)dictationContext;
143 #endif
144
145 #if ENABLE(SERVICE_CONTROLS)
146 - (WebSelectionServiceController&)_selectionServiceController;
147 #endif
148
149 @end
150
151 #endif
152
153 #if PLATFORM(IOS)
154 @interface NSObject (WebSafeForwarder)
155 - (id)asyncForwarder;
156 @end
157 #endif
158
159 // FIXME: Temporary way to expose methods that are in the wrong category inside WebView.
160 @interface WebView (WebViewOtherInternal)
161
162 + (void)_setCacheModel:(WebCacheModel)cacheModel;
163 + (WebCacheModel)_cacheModel;
164
165 #ifdef __cplusplus
166 - (WebCore::Page*)page;
167 - (void)_setGlobalHistoryItem:(WebCore::HistoryItem*)historyItem;
168 - (WTF::String)_userAgentString;
169 #endif
170
171 #if !PLATFORM(IOS)
172 - (NSMenu *)_menuForElement:(NSDictionary *)element defaultItems:(NSArray *)items;
173 #endif
174 - (id)_UIDelegateForwarder;
175 #if PLATFORM(IOS)
176 - (id)_UIDelegateForSelector:(SEL)selector;
177 #endif
178 - (id)_editingDelegateForwarder;
179 - (id)_policyDelegateForwarder;
180 #if PLATFORM(IOS)
181 - (id)_frameLoadDelegateForwarder;
182 - (id)_resourceLoadDelegateForwarder;
183 - (id)_UIKitDelegateForwarder;
184 #endif
185 - (void)_pushPerformingProgrammaticFocus;
186 - (void)_popPerformingProgrammaticFocus;
187 #if !PLATFORM(IOS)
188 - (void)_didStartProvisionalLoadForFrame:(WebFrame *)frame;
189 #endif
190 + (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins;
191 - (BOOL)_viewClass:(Class *)vClass andRepresentationClass:(Class *)rClass forMIMEType:(NSString *)MIMEType;
192 + (void)_registerPluginMIMEType:(NSString *)MIMEType;
193 + (void)_unregisterPluginMIMEType:(NSString *)MIMEType;
194 + (BOOL)_canShowMIMEType:(NSString *)MIMEType allowingPlugins:(BOOL)allowPlugins;
195 - (BOOL)_canShowMIMEType:(NSString *)MIMEType;
196 + (NSString *)_MIMETypeForFile:(NSString *)path;
197 - (WebDownload *)_downloadURL:(NSURL *)URL;
198 + (NSString *)_generatedMIMETypeForURLScheme:(NSString *)URLScheme;
199 + (BOOL)_representationExistsForURLScheme:(NSString *)URLScheme;
200 - (BOOL)_isPerformingProgrammaticFocus;
201 - (void)_mouseDidMoveOverElement:(NSDictionary *)dictionary modifierFlags:(NSUInteger)modifierFlags;
202 - (WebView *)_openNewWindowWithRequest:(NSURLRequest *)request;
203 #if !PLATFORM(IOS)
204 - (void)_writeImageForElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
205 - (void)_writeLinkElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
206 - (void)_openFrameInNewWindowFromMenu:(NSMenuItem *)sender;
207 - (void)_searchWithGoogleFromMenu:(id)sender;
208 - (void)_searchWithSpotlightFromMenu:(id)sender;
209 #endif
210 - (void)_progressCompleted:(WebFrame *)frame;
211 - (void)_didCommitLoadForFrame:(WebFrame *)frame;
212 #if !PLATFORM(IOS)
213 - (void)_didFinishLoadForFrame:(WebFrame *)frame;
214 - (void)_didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
215 - (void)_didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
216 #endif
217 - (void)_willChangeValueForKey:(NSString *)key;
218 - (void)_didChangeValueForKey:(NSString *)key;
219 - (WebBasePluginPackage *)_pluginForMIMEType:(NSString *)MIMEType;
220 - (WebBasePluginPackage *)_pluginForExtension:(NSString *)extension;
221
222 - (void)setCurrentNodeHighlight:(WebNodeHighlight *)nodeHighlight;
223 - (WebNodeHighlight *)currentNodeHighlight;
224
225 #if !PLATFORM(IOS)
226 - (void)addPluginInstanceView:(NSView *)view;
227 - (void)removePluginInstanceView:(NSView *)view;
228 - (void)removePluginInstanceViewsFor:(WebFrame*)webFrame;
229 #endif
230
231 - (void)_addObject:(id)object forIdentifier:(unsigned long)identifier;
232 - (id)_objectForIdentifier:(unsigned long)identifier;
233 - (void)_removeObjectForIdentifier:(unsigned long)identifier;
234
235 - (void)_setZoomMultiplier:(float)multiplier isTextOnly:(BOOL)isTextOnly;
236 - (float)_zoomMultiplier:(BOOL)isTextOnly;
237 - (float)_realZoomMultiplier;
238 - (BOOL)_realZoomMultiplierIsTextOnly;
239 - (BOOL)_canZoomOut:(BOOL)isTextOnly;
240 - (BOOL)_canZoomIn:(BOOL)isTextOnly;
241 - (IBAction)_zoomOut:(id)sender isTextOnly:(BOOL)isTextOnly;
242 - (IBAction)_zoomIn:(id)sender isTextOnly:(BOOL)isTextOnly;
243 - (BOOL)_canResetZoom:(BOOL)isTextOnly;
244 - (IBAction)_resetZoom:(id)sender isTextOnly:(BOOL)isTextOnly;
245
246 + (BOOL)_canHandleRequest:(NSURLRequest *)request forMainFrame:(BOOL)forMainFrame;
247
248 #if !PLATFORM(IOS)
249 - (void)_setInsertionPasteboard:(NSPasteboard *)pasteboard;
250 #endif
251
252 #if PLATFORM(IOS)
253 - (BOOL)_isStopping;
254 - (BOOL)_isClosing;
255
256 - (void)_documentScaleChanged;
257 - (BOOL)_fetchCustomFixedPositionLayoutRect:(NSRect*)rect;
258 #if ENABLE(ORIENTATION_EVENTS)
259 - (void)_setDeviceOrientation:(NSUInteger)orientation;
260 - (NSUInteger)_deviceOrientation;
261 #endif
262 #endif
263
264 #if ENABLE(DATA_INTERACTION) && defined(__cplusplus)
265 - (void)_startDrag:(const WebCore::DragItem&)dragItem;
266 - (void)_didConcludeEditDataInteraction;
267 #endif
268
269 - (void)_preferencesChanged:(WebPreferences *)preferences;
270
271 #if ENABLE(VIDEO) && defined(__cplusplus)
272 - (void)_enterVideoFullscreenForVideoElement:(WebCore::HTMLVideoElement*)videoElement mode:(WebCore::HTMLMediaElementEnums::VideoFullscreenMode)mode;
273 - (void)_exitVideoFullscreen;
274 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
275 - (BOOL)_hasActiveVideoForControlsInterface;
276 - (void)_setUpPlaybackControlsManagerForMediaElement:(WebCore::HTMLMediaElement&)mediaElement;
277 - (void)_clearPlaybackControlsManager;
278 #endif
279 #endif
280
281 #if ENABLE(FULLSCREEN_API) && !PLATFORM(IOS) && defined(__cplusplus)
282 - (BOOL)_supportsFullScreenForElement:(WebCore::Element*)element withKeyboard:(BOOL)withKeyboard;
283 - (void)_enterFullScreenForElement:(WebCore::Element*)element;
284 - (void)_exitFullScreenForElement:(WebCore::Element*)element;
285 #endif
286
287 // Conversion functions between WebCore root view coordinates and web view coordinates.
288 - (NSPoint)_convertPointFromRootView:(NSPoint)point;
289 - (NSRect)_convertRectFromRootView:(NSRect)rect;
290
291 - (void)_setMaintainsInactiveSelection:(BOOL)shouldMaintainInactiveSelection;
292
293 #if PLATFORM(MAC) && defined(__cplusplus)
294 - (void)_setTextIndicator:(WebCore::TextIndicator&)textIndicator;
295 - (void)_setTextIndicator:(WebCore::TextIndicator&)textIndicator withLifetime:(WebCore::TextIndicatorWindowLifetime)lifetime;
296 - (void)_clearTextIndicatorWithAnimation:(WebCore::TextIndicatorWindowDismissalAnimation)animation;
297 - (void)_setTextIndicatorAnimationProgress:(float)progress;
298 - (void)_showDictionaryLookupPopup:(const WebCore::DictionaryPopupInfo&)dictionaryPopupInfo;
299 - (id)_animationControllerForDictionaryLookupPopupInfo:(const WebCore::DictionaryPopupInfo&)dictionaryPopupInfo;
300 - (WebImmediateActionController *)_immediateActionController;
301 - (NSEvent *)_pressureEvent;
302 - (void)_setPressureEvent:(NSEvent *)event;
303 #endif
304
305 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS) && defined(__cplusplus)
306 - (WebMediaPlaybackTargetPicker *) _devicePicker;
307 - (void)_addPlaybackTargetPickerClient:(uint64_t)clientId;
308 - (void)_removePlaybackTargetPickerClient:(uint64_t)contextId;
309 - (void)_showPlaybackTargetPicker:(uint64_t)contextId location:(const WebCore::IntPoint&)location hasVideo:(BOOL)hasVideo;
310 - (void)_playbackTargetPickerClientStateDidChange:(uint64_t)contextId state:(WebCore::MediaProducer::MediaStateFlags)state;
311 - (void)_setMockMediaPlaybackTargetPickerEnabled:(bool)enabled;
312 - (void)_setMockMediaPlaybackTargetPickerName:(NSString *)name state:(WebCore::MediaPlaybackTargetContext::State)state;
313 #endif
314
315 - (void)prepareForMouseUp;
316 - (void)prepareForMouseDown;
317 - (void)updateTouchBar;
318 - (void)_dismissTextTouchBarPopoverItemWithIdentifier:(NSString *)identifier;
319 - (NSCandidateListTouchBarItem *)candidateList;
320
321 - (void)showFormValidationMessage:(NSString *)message withAnchorRect:(NSRect)anchorRect;
322 - (void)hideFormValidationMessage;
323
324 #if !PLATFORM(IOS)
325 - (void)_setMainFrameIcon:(NSImage *)icon;
326 #endif
327 @end