WKView being inside WKWebView leads to weird API issues
[WebKit-https.git] / Source / WebKit2 / UIProcess / Cocoa / WebViewImpl.h
1 /*
2  * Copyright (C) 2015 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  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #ifndef WebViewImpl_h
27 #define WebViewImpl_h
28
29 #if PLATFORM(MAC)
30
31 #include "PluginComplexTextInputState.h"
32 #include "WKLayoutMode.h"
33 #include "WebPageProxy.h"
34 #include "_WKOverlayScrollbarStyle.h"
35 #include <WebCore/TextIndicatorWindow.h>
36 #include <functional>
37 #include <wtf/RetainPtr.h>
38 #include <wtf/WeakPtr.h>
39 #include <wtf/text/WTFString.h>
40
41 OBJC_CLASS NSImmediateActionGestureRecognizer;
42 OBJC_CLASS NSTextInputContext;
43 OBJC_CLASS NSView;
44 OBJC_CLASS WKBrowsingContextController;
45 OBJC_CLASS WKEditorUndoTargetObjC;
46 OBJC_CLASS WKFullScreenWindowController;
47 OBJC_CLASS WKImmediateActionController;
48 OBJC_CLASS WKViewLayoutStrategy;
49 OBJC_CLASS WKWindowVisibilityObserver;
50 OBJC_CLASS _WKThumbnailView;
51
52 @protocol WebViewImplDelegate
53
54 - (NSTextInputContext *)_superInputContext;
55 - (void)_superQuickLookWithEvent:(NSEvent *)event;
56 - (void)_superRemoveTrackingRect:(NSTrackingRectTag)tag;
57 - (void)_superSwipeWithEvent:(NSEvent *)event;
58 - (void)_superMagnifyWithEvent:(NSEvent *)event;
59 - (void)_superSmartMagnifyWithEvent:(NSEvent *)event;
60 - (id)_superAccessibilityAttributeValue:(NSString *)attribute;
61 - (void)_superDoCommandBySelector:(SEL)selector;
62 - (BOOL)_superPerformKeyEquivalent:(NSEvent *)event;
63 - (void)_superKeyDown:(NSEvent *)event;
64 - (NSView *)_superHitTest:(NSPoint)point;
65
66 // This is a hack; these things live can live on a category (e.g. WKView (Private)) but WKView itself conforms to this protocol.
67 // They're not actually optional.
68 @optional
69
70 - (id)_immediateActionAnimationControllerForHitTestResult:(WKHitTestResultRef)hitTestResult withType:(uint32_t)type userData:(WKTypeRef)userData;
71 - (void)_prepareForImmediateActionAnimation;
72 - (void)_cancelImmediateActionAnimation;
73 - (void)_completeImmediateActionAnimation;
74 - (void)_dismissContentRelativeChildWindows;
75 - (void)_dismissContentRelativeChildWindowsWithAnimation:(BOOL)animate;
76 - (void)_gestureEventWasNotHandledByWebCore:(NSEvent *)event;
77
78 @end
79
80 namespace WebCore {
81 struct KeyPressCommand;
82 }
83
84 namespace WebKit {
85
86 class DrawingAreaProxy;
87 class ViewGestureController;
88 class WebEditCommandProxy;
89 class WebPageProxy;
90 struct ColorSpaceData;
91
92 typedef id <NSValidatedUserInterfaceItem> ValidationItem;
93 typedef Vector<RetainPtr<ValidationItem>> ValidationVector;
94 typedef HashMap<String, ValidationVector> ValidationMap;
95
96 #if !USE(ASYNC_NSTEXTINPUTCLIENT)
97 struct WKViewInterpretKeyEventsParameters {
98     bool eventInterpretationHadSideEffects;
99     bool consumedByIM;
100     bool executingSavedKeypressCommands;
101     Vector<WebCore::KeypressCommand>* commands;
102 };
103 #endif
104
105 class WebViewImpl {
106     WTF_MAKE_FAST_ALLOCATED;
107     WTF_MAKE_NONCOPYABLE(WebViewImpl);
108 public:
109     WebViewImpl(NSView <WebViewImplDelegate> *, WebPageProxy&, PageClient&);
110
111     ~WebViewImpl();
112
113     NSWindow *window();
114
115     void processDidExit();
116     void pageClosed();
117     void didRelaunchProcess();
118
119     void setDrawsBackground(bool);
120     bool drawsBackground() const;
121     void setDrawsTransparentBackground(bool);
122     bool drawsTransparentBackground() const;
123     bool isOpaque() const;
124
125     bool acceptsFirstMouse(NSEvent *);
126     bool acceptsFirstResponder();
127     bool becomeFirstResponder();
128     bool resignFirstResponder();
129     bool isFocused() const;
130
131     void viewWillStartLiveResize();
132     void viewDidEndLiveResize();
133
134     void renewGState();
135     void setFrameSize(CGSize);
136     void disableFrameSizeUpdates();
137     void enableFrameSizeUpdates();
138     bool frameSizeUpdatesDisabled() const;
139     void setFrameAndScrollBy(CGRect, CGSize);
140     void updateWindowAndViewFrames();
141
142     void setFixedLayoutSize(CGSize);
143     CGSize fixedLayoutSize() const;
144
145     std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy();
146     bool isUsingUISideCompositing() const;
147     void setDrawingAreaSize(CGSize);
148     void forceAsyncDrawingAreaSizeUpdate(CGSize);
149     void waitForAsyncDrawingAreaSizeUpdate();
150     void updateLayer();
151     static bool wantsUpdateLayer() { return true; }
152
153     void drawRect(CGRect);
154     bool canChangeFrameLayout(WebFrameProxy&);
155     NSPrintOperation *printOperationWithPrintInfo(NSPrintInfo *, WebFrameProxy&);
156
157     void setAutomaticallyAdjustsContentInsets(bool);
158     bool automaticallyAdjustsContentInsets() const { return m_automaticallyAdjustsContentInsets; }
159     void updateContentInsetsIfAutomatic();
160     void setTopContentInset(CGFloat);
161     CGFloat topContentInset() const { return m_topContentInset; }
162
163     void setContentPreparationRect(CGRect);
164     void updateViewExposedRect();
165     void setClipsToVisibleRect(bool);
166     bool clipsToVisibleRect() const { return m_clipsToVisibleRect; }
167
168     void setMinimumSizeForAutoLayout(CGSize);
169     CGSize minimumSizeForAutoLayout() const;
170     void setShouldExpandToViewHeightForAutoLayout(bool);
171     bool shouldExpandToViewHeightForAutoLayout() const;
172     void setIntrinsicContentSize(CGSize);
173     CGSize intrinsicContentSize() const;
174
175     void setViewScale(CGFloat);
176     CGFloat viewScale() const;
177
178     WKLayoutMode layoutMode() const;
179     void setLayoutMode(WKLayoutMode);
180     void updateSupportsArbitraryLayoutModes();
181
182     void setOverrideDeviceScaleFactor(CGFloat);
183     CGFloat overrideDeviceScaleFactor() const { return m_overrideDeviceScaleFactor; }
184
185     void windowDidOrderOffScreen();
186     void windowDidOrderOnScreen();
187     void windowDidBecomeKey(NSWindow *);
188     void windowDidResignKey(NSWindow *);
189     void windowDidMiniaturize();
190     void windowDidDeminiaturize();
191     void windowDidMove();
192     void windowDidResize();
193     void windowDidChangeBackingProperties(CGFloat oldBackingScaleFactor);
194     void windowDidChangeScreen();
195     void windowDidChangeLayerHosting();
196     void windowDidChangeOcclusionState();
197     bool shouldDelayWindowOrderingForEvent(NSEvent *);
198     bool windowResizeMouseLocationIsInVisibleScrollerThumb(CGPoint);
199
200     // -[NSView mouseDownCanMoveWindow] returns YES when the NSView is transparent,
201     // but we don't want a drag in the NSView to move the window, even if it's transparent.
202     static bool mouseDownCanMoveWindow() { return false; }
203
204     void viewWillMoveToWindow(NSWindow *);
205     void viewDidMoveToWindow();
206     void viewDidChangeBackingProperties();
207     void viewDidHide();
208     void viewDidUnhide();
209     void activeSpaceDidChange();
210
211     NSView *hitTest(CGPoint);
212
213     ColorSpaceData colorSpace();
214
215     void setUnderlayColor(NSColor *);
216     NSColor *underlayColor() const;
217     NSColor *pageExtendedBackgroundColor() const;
218
219     void setOverlayScrollbarStyle(WTF::Optional<WebCore::ScrollbarOverlayStyle> scrollbarStyle);
220     WTF::Optional<WebCore::ScrollbarOverlayStyle> overlayScrollbarStyle() const;
221
222     void beginDeferringViewInWindowChanges();
223     // FIXME: Merge these two?
224     void endDeferringViewInWindowChanges();
225     void endDeferringViewInWindowChangesSync();
226     bool isDeferringViewInWindowChanges() const { return m_shouldDeferViewInWindowChanges; }
227
228     void setWindowOcclusionDetectionEnabled(bool enabled) { m_windowOcclusionDetectionEnabled = enabled; }
229     bool windowOcclusionDetectionEnabled() const { return m_windowOcclusionDetectionEnabled; }
230
231     void prepareForMoveToWindow(NSWindow *targetWindow, std::function<void()> completionHandler);
232     NSWindow *targetWindowForMovePreparation() const { return m_targetWindowForMovePreparation; }
233
234     void updateSecureInputState();
235     void resetSecureInputState();
236     bool inSecureInputState() const { return m_inSecureInputState; }
237     void notifyInputContextAboutDiscardedComposition();
238     void setPluginComplexTextInputStateAndIdentifier(PluginComplexTextInputState, uint64_t identifier);
239     void disableComplexTextInputIfNecessary();
240     bool handlePluginComplexTextInputKeyDown(NSEvent *);
241     bool tryHandlePluginComplexTextInputKeyDown(NSEvent *);
242     void pluginFocusOrWindowFocusChanged(bool pluginHasFocusAndWindowHasFocus, uint64_t pluginComplexTextInputIdentifier);
243     bool tryPostProcessPluginComplexTextInputKeyDown(NSEvent *);
244     PluginComplexTextInputState pluginComplexTextInputState() const { return m_pluginComplexTextInputState; }
245     uint64_t pluginComplexTextInputIdentifier() const { return m_pluginComplexTextInputIdentifier; }
246     
247     void handleAcceptedAlternativeText(const String&);
248     NSInteger spellCheckerDocumentTag();
249
250     void pressureChangeWithEvent(NSEvent *);
251     NSEvent *lastPressureEvent() { return m_lastPressureEvent.get(); }
252
253 #if ENABLE(FULLSCREEN_API)
254     bool hasFullScreenWindowController() const;
255     WKFullScreenWindowController *fullScreenWindowController();
256     void closeFullScreenWindowController();
257 #endif
258     NSView *fullScreenPlaceholderView();
259     NSWindow *createFullScreenWindow();
260
261     bool isEditable() const;
262     bool executeSavedCommandBySelector(SEL);
263     void executeEditCommandForSelector(SEL, const String& argument = String());
264     void registerEditCommand(RefPtr<WebEditCommandProxy>, WebPageProxy::UndoOrRedo);
265     void clearAllEditCommands();
266     bool writeSelectionToPasteboard(NSPasteboard *, NSArray *types);
267     bool readSelectionFromPasteboard(NSPasteboard *);
268     id validRequestorForSendAndReturnTypes(NSString *sendType, NSString *returnType);
269     void centerSelectionInVisibleArea();
270     void selectionDidChange();
271     void startObservingFontPanel();
272     void updateFontPanelIfNeeded();
273     void changeFontFromFontPanel();
274     bool validateUserInterfaceItem(id <NSValidatedUserInterfaceItem>);
275
276     void startSpeaking();
277     void stopSpeaking(id);
278
279     void showGuessPanel(id);
280     void checkSpelling();
281     void changeSpelling(id);
282     void toggleContinuousSpellChecking();
283
284     bool isGrammarCheckingEnabled();
285     void setGrammarCheckingEnabled(bool);
286     void toggleGrammarChecking();
287     void toggleAutomaticSpellingCorrection();
288     void orderFrontSubstitutionsPanel(id);
289     void toggleSmartInsertDelete();
290     bool isAutomaticQuoteSubstitutionEnabled();
291     void setAutomaticQuoteSubstitutionEnabled(bool);
292     void toggleAutomaticQuoteSubstitution();
293     bool isAutomaticDashSubstitutionEnabled();
294     void setAutomaticDashSubstitutionEnabled(bool);
295     void toggleAutomaticDashSubstitution();
296     bool isAutomaticLinkDetectionEnabled();
297     void setAutomaticLinkDetectionEnabled(bool);
298     void toggleAutomaticLinkDetection();
299     bool isAutomaticTextReplacementEnabled();
300     void setAutomaticTextReplacementEnabled(bool);
301     void toggleAutomaticTextReplacement();
302     void uppercaseWord();
303     void lowercaseWord();
304     void capitalizeWord();
305
306     void preferencesDidChange();
307
308     void setTextIndicator(WebCore::TextIndicator&, WebCore::TextIndicatorWindowLifetime = WebCore::TextIndicatorWindowLifetime::Permanent);
309     void clearTextIndicatorWithAnimation(WebCore::TextIndicatorWindowDismissalAnimation);
310     void setTextIndicatorAnimationProgress(float);
311     void dismissContentRelativeChildWindows();
312     void dismissContentRelativeChildWindowsFromViewOnly();
313     void dismissContentRelativeChildWindowsWithAnimation(bool);
314     void dismissContentRelativeChildWindowsWithAnimationFromViewOnly(bool);
315     static void hideWordDefinitionWindow();
316
317     void quickLookWithEvent(NSEvent *);
318     void prepareForDictionaryLookup();
319     void setAllowsLinkPreview(bool);
320     bool allowsLinkPreview() const { return m_allowsLinkPreview; }
321     void* immediateActionAnimationControllerForHitTestResult(WKHitTestResultRef, uint32_t type, WKTypeRef userData);
322     void* immediateActionAnimationControllerForHitTestResultFromViewOnly(WKHitTestResultRef, uint32_t type, WKTypeRef userData);
323     void didPerformImmediateActionHitTest(const WebHitTestResultData&, bool contentPreventsDefault, API::Object* userData);
324     void prepareForImmediateActionAnimation();
325     void cancelImmediateActionAnimation();
326     void completeImmediateActionAnimation();
327
328     void setIgnoresNonWheelEvents(bool);
329     bool ignoresNonWheelEvents() const { return m_ignoresNonWheelEvents; }
330     void setIgnoresAllEvents(bool);
331     bool ignoresAllEvents() const { return m_ignoresAllEvents; }
332     void setIgnoresMouseDraggedEvents(bool);
333     bool ignoresMouseDraggedEvents() const { return m_ignoresMouseDraggedEvents; }
334
335     void setAccessibilityWebProcessToken(NSData *);
336     void accessibilityRegisterUIProcessTokens();
337     void updateRemoteAccessibilityRegistration(bool registerProcess);
338     id accessibilityFocusedUIElement();
339     bool accessibilityIsIgnored() const { return false; }
340     id accessibilityHitTest(CGPoint);
341     void enableAccessibilityIfNecessary();
342     id accessibilityAttributeValue(NSString *);
343
344     NSTrackingArea *primaryTrackingArea() const { return m_primaryTrackingArea.get(); }
345     void setPrimaryTrackingArea(NSTrackingArea *);
346
347     NSTrackingRectTag addTrackingRect(CGRect, id owner, void* userData, bool assumeInside);
348     NSTrackingRectTag addTrackingRectWithTrackingNum(CGRect, id owner, void* userData, bool assumeInside, int tag);
349     void addTrackingRectsWithTrackingNums(CGRect*, id owner, void** userDataList, bool assumeInside, NSTrackingRectTag *trackingNums, int count);
350     void removeTrackingRect(NSTrackingRectTag);
351     void removeTrackingRects(NSTrackingRectTag *, int count);
352     NSString *stringForToolTip(NSToolTipTag tag);
353     void toolTipChanged(const String& oldToolTip, const String& newToolTip);
354
355     void setAcceleratedCompositingRootLayer(CALayer *);
356     CALayer *acceleratedCompositingRootLayer() const { return m_rootLayer.get(); }
357
358 #if WK_API_ENABLED
359     void setThumbnailView(_WKThumbnailView *);
360     _WKThumbnailView *thumbnailView() const { return m_thumbnailView; }
361
362     void setInspectorAttachmentView(NSView *);
363     NSView *inspectorAttachmentView();
364
365     _WKRemoteObjectRegistry *remoteObjectRegistry();
366     void destroyRemoteObjectRegistry(); // FIXME: Temporary. Can fold in after we move ownership of WebPageProxy here.
367
368     WKBrowsingContextController *browsingContextController();
369 #endif // WK_API_ENABLED
370
371 #if ENABLE(DRAG_SUPPORT)
372     void draggedImage(NSImage *, CGPoint endPoint, NSDragOperation);
373     NSDragOperation draggingEntered(id <NSDraggingInfo>);
374     NSDragOperation draggingUpdated(id <NSDraggingInfo>);
375     void draggingExited(id <NSDraggingInfo>);
376     bool prepareForDragOperation(id <NSDraggingInfo>);
377     bool performDragOperation(id <NSDraggingInfo>);
378     NSView *hitTestForDragTypes(CGPoint, NSSet *types);
379     void registerDraggedTypes();
380 #endif
381
382 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
383     void startWindowDrag();
384 #endif
385
386     void dragImageForView(NSView *, NSImage *, CGPoint clientPoint, bool linkDrag);
387     void setFileAndURLTypes(NSString *filename, NSString *extension, NSString *title, NSString *url, NSString *visibleURL, NSPasteboard *);
388     void setPromisedDataForImage(WebCore::Image*, NSString *filename, NSString *extension, NSString *title, NSString *url, NSString *visibleURL, WebCore::SharedBuffer* archiveBuffer, NSString *pasteboardName);
389 #if ENABLE(ATTACHMENT_ELEMENT)
390     void setPromisedDataForAttachment(NSString *filename, NSString *extension, NSString *title, NSString *url, NSString *visibleURL, NSString *pasteboardName);
391 #endif
392     void pasteboardChangedOwner(NSPasteboard *);
393     void provideDataForPasteboard(NSPasteboard *, NSString *type);
394     NSArray *namesOfPromisedFilesDroppedAtDestination(NSURL *dropDestination);
395
396     RefPtr<ViewSnapshot> takeViewSnapshot();
397     void saveBackForwardSnapshotForCurrentItem();
398     void saveBackForwardSnapshotForItem(WebBackForwardListItem&);
399
400     ViewGestureController* gestureController() { return m_gestureController.get(); }
401     ViewGestureController& ensureGestureController();
402     void setAllowsBackForwardNavigationGestures(bool);
403     bool allowsBackForwardNavigationGestures() const { return m_allowsBackForwardNavigationGestures; }
404     void setAllowsMagnification(bool);
405     bool allowsMagnification() const { return m_allowsMagnification; }
406
407     void setMagnification(double, CGPoint centerPoint);
408     void setMagnification(double);
409     double magnification() const;
410     void setCustomSwipeViews(NSArray *);
411     void setCustomSwipeViewsTopContentInset(float);
412     bool tryToSwipeWithEvent(NSEvent *, bool ignoringPinnedState);
413     void setDidMoveSwipeSnapshotCallback(void(^)(CGRect));
414
415     void scrollWheel(NSEvent *);
416     void swipeWithEvent(NSEvent *);
417     void magnifyWithEvent(NSEvent *);
418     void rotateWithEvent(NSEvent *);
419     void smartMagnifyWithEvent(NSEvent *);
420
421     void setLastMouseDownEvent(NSEvent *);
422
423     void gestureEventWasNotHandledByWebCore(NSEvent *);
424     void gestureEventWasNotHandledByWebCoreFromViewOnly(NSEvent *);
425
426     void setTotalHeightOfBanners(CGFloat totalHeightOfBanners) { m_totalHeightOfBanners = totalHeightOfBanners; }
427     CGFloat totalHeightOfBanners() const { return m_totalHeightOfBanners; }
428
429     void doneWithKeyEvent(NSEvent *, bool eventWasHandled);
430     NSArray *validAttributesForMarkedText();
431     void doCommandBySelector(SEL);
432     void insertText(id string);
433     void insertText(id string, NSRange replacementRange);
434     NSTextInputContext *inputContext();
435     void unmarkText();
436     void setMarkedText(id string, NSRange selectedRange, NSRange replacementRange);
437     NSRange selectedRange();
438     bool hasMarkedText();
439     NSRange markedRange();
440     NSAttributedString *attributedSubstringForProposedRange(NSRange, NSRangePointer actualRange);
441     NSUInteger characterIndexForPoint(NSPoint);
442     NSRect firstRectForCharacterRange(NSRange, NSRangePointer actualRange);
443     bool performKeyEquivalent(NSEvent *);
444     void keyUp(NSEvent *);
445     void keyDown(NSEvent *);
446     void flagsChanged(NSEvent *);
447
448     // Override this so that AppKit will send us arrow keys as key down events so we can
449     // support them via the key bindings mechanism.
450     static bool wantsKeyDownForEvent(NSEvent *) { return true; }
451
452 #if USE(ASYNC_NSTEXTINPUTCLIENT)
453     void selectedRangeWithCompletionHandler(void(^)(NSRange));
454     void hasMarkedTextWithCompletionHandler(void(^)(BOOL hasMarkedText));
455     void markedRangeWithCompletionHandler(void(^)(NSRange));
456     void attributedSubstringForProposedRange(NSRange, void(^)(NSAttributedString *attrString, NSRange actualRange));
457     void firstRectForCharacterRange(NSRange, void(^)(NSRect firstRect, NSRange actualRange));
458     void characterIndexForPoint(NSPoint, void(^)(NSUInteger));
459 #endif // USE(ASYNC_NSTEXTINPUTCLIENT)
460
461 private:
462     WeakPtr<WebViewImpl> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
463
464     bool supportsArbitraryLayoutModes() const;
465     float intrinsicDeviceScaleFactor() const;
466     void dispatchSetTopContentInset();
467
468     void postFakeMouseMovedEventForFlagsChangedEvent(NSEvent *);
469
470     void setPluginComplexTextInputState(PluginComplexTextInputState);
471
472     void sendToolTipMouseExited();
473     void sendToolTipMouseEntered();
474
475     void reparentLayerTreeInThumbnailView();
476     void updateThumbnailViewLayer();
477
478     void setUserInterfaceItemState(NSString *commandName, bool enabled, int state);
479
480 #if USE(ASYNC_NSTEXTINPUTCLIENT)
481     Vector<WebCore::KeypressCommand> collectKeyboardLayoutCommandsForEvent(NSEvent *);
482     void interpretKeyEvent(NSEvent *, void(^completionHandler)(BOOL handled, const Vector<WebCore::KeypressCommand>&));
483 #else
484     void executeSavedKeypressCommands();
485     bool interpretKeyEvent(NSEvent *, Vector<WebCore::KeypressCommand>&);
486 #endif
487
488     NSView <WebViewImplDelegate> *m_view;
489     WebPageProxy& m_page;
490     PageClient& m_pageClient;
491
492     WeakPtrFactory<WebViewImpl> m_weakPtrFactory;
493
494     bool m_willBecomeFirstResponderAgain { false };
495     bool m_inBecomeFirstResponder { false };
496     bool m_inResignFirstResponder { false };
497
498     CGRect m_contentPreparationRect { { 0, 0 }, { 0, 0 } };
499     bool m_useContentPreparationRectForVisibleRect { false };
500     bool m_clipsToVisibleRect { false };
501     bool m_needsViewFrameInWindowCoordinates;
502     bool m_didScheduleWindowAndViewFrameUpdate { false };
503     bool m_isDeferringViewInWindowChanges { false };
504     bool m_windowOcclusionDetectionEnabled { true };
505
506     bool m_automaticallyAdjustsContentInsets { false };
507     CGFloat m_topContentInset { 0 };
508     bool m_didScheduleSetTopContentInset { false };
509
510     CGSize m_resizeScrollOffset { 0, 0 };
511
512     CGSize m_intrinsicContentSize { 0, 0 };
513     CGFloat m_overrideDeviceScaleFactor { 0 };
514
515     RetainPtr<WKViewLayoutStrategy> m_layoutStrategy;
516     WKLayoutMode m_lastRequestedLayoutMode { kWKLayoutModeViewSize };
517     CGFloat m_lastRequestedViewScale { 1 };
518
519     bool m_inSecureInputState { false };
520     RetainPtr<WKEditorUndoTargetObjC> m_undoTarget;
521
522     ValidationMap m_validationMap;
523
524     // The identifier of the plug-in we want to send complex text input to, or 0 if there is none.
525     uint64_t m_pluginComplexTextInputIdentifier { 0 };
526
527     // The state of complex text input for the plug-in.
528     PluginComplexTextInputState m_pluginComplexTextInputState { PluginComplexTextInputDisabled };
529
530 #if ENABLE(FULLSCREEN_API)
531     RetainPtr<WKFullScreenWindowController> m_fullScreenWindowController;
532 #endif
533
534     RetainPtr<WKWindowVisibilityObserver> m_windowVisibilityObserver;
535
536     bool m_shouldDeferViewInWindowChanges { false };
537     bool m_viewInWindowChangeWasDeferred { false };
538     NSWindow *m_targetWindowForMovePreparation { nullptr };
539
540     id m_flagsChangedEventMonitor { nullptr };
541
542     std::unique_ptr<WebCore::TextIndicatorWindow> m_textIndicatorWindow;
543
544     RetainPtr<NSColorSpace> m_colorSpace;
545
546     RetainPtr<NSEvent> m_lastMouseDownEvent;
547     RetainPtr<NSEvent> m_lastPressureEvent;
548
549     bool m_ignoresNonWheelEvents { false };
550     bool m_ignoresAllEvents { false };
551     bool m_ignoresMouseDraggedEvents { false };
552
553 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
554     RetainPtr<WKImmediateActionController> m_immediateActionController;
555     RetainPtr<NSImmediateActionGestureRecognizer> m_immediateActionGestureRecognizer;
556 #endif
557
558     bool m_allowsLinkPreview { true };
559     bool m_didRegisterForLookupPopoverCloseNotifications { false };
560
561     RetainPtr<NSTrackingArea> m_primaryTrackingArea;
562
563     NSToolTipTag m_lastToolTipTag { 0 };
564     id m_trackingRectOwner { nil };
565     void* m_trackingRectUserData { nullptr };
566
567     RetainPtr<CALayer> m_rootLayer;
568     RetainPtr<NSView> m_layerHostingView;
569
570 #if WK_API_ENABLED
571     _WKThumbnailView *m_thumbnailView { nullptr };
572
573     RetainPtr<_WKRemoteObjectRegistry> m_remoteObjectRegistry;
574
575     RetainPtr<WKBrowsingContextController> m_browsingContextController;
576 #endif
577
578     std::unique_ptr<ViewGestureController> m_gestureController;
579     bool m_allowsBackForwardNavigationGestures { false };
580     bool m_allowsMagnification { false };
581
582     RetainPtr<id> m_remoteAccessibilityChild;
583
584     RefPtr<WebCore::Image> m_promisedImage;
585     String m_promisedFilename;
586     String m_promisedURL;
587
588     WTF::Optional<NSInteger> m_spellCheckerDocumentTag;
589
590     CGFloat m_totalHeightOfBanners { 0 };
591
592     RetainPtr<NSView> m_inspectorAttachmentView;
593
594     // We keep here the event when resending it to
595     // the application to distinguish the case of a new event from one
596     // that has been already sent to WebCore.
597     RetainPtr<NSEvent> m_keyDownEventBeingResent;
598 #if USE(ASYNC_NSTEXTINPUTCLIENT)
599     Vector<WebCore::KeypressCommand>* m_collectedKeypressCommands { nullptr };
600 #else
601     WKViewInterpretKeyEventsParameters* m_interpretKeyEventsParameters { nullptr };
602 #endif
603 };
604     
605 } // namespace WebKit
606
607 #endif // PLATFORM(MAC)
608
609 #endif // WebViewImpl_h