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