2 * Copyright (C) 2010, 2011 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
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.
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.
27 #import "PageClientImpl.h"
31 #import "AttributedString.h"
32 #import "ColorSpaceData.h"
33 #import "DataReference.h"
34 #import "DictionaryPopupInfo.h"
35 #import "DownloadProxy.h"
36 #import "NativeWebKeyboardEvent.h"
37 #import "NativeWebWheelEvent.h"
38 #import "NavigationState.h"
39 #import "StringUtilities.h"
40 #import "ViewSnapshotStore.h"
42 #import "WKFullScreenWindowController.h"
43 #import "WKStringCF.h"
44 #import "WKViewInternal.h"
45 #import "WKWebViewInternal.h"
46 #import "WebColorPickerMac.h"
47 #import "WebContextMenuProxyMac.h"
48 #import "WebEditCommandProxy.h"
49 #import "WebPopupMenuProxyMac.h"
50 #import "WindowServerConnection.h"
51 #import "_WKDownloadInternal.h"
52 #import "_WKThumbnailView.h"
53 #import <WebCore/AlternativeTextUIController.h>
54 #import <WebCore/BitmapImage.h>
55 #import <WebCore/Cursor.h>
56 #import <WebCore/FloatRect.h>
57 #import <WebCore/GraphicsContext.h>
58 #import <WebCore/Image.h>
59 #import <WebCore/KeyboardEvent.h>
60 #import <WebCore/LookupSPI.h>
61 #import <WebCore/NotImplemented.h>
62 #import <WebCore/SharedBuffer.h>
63 #import <WebCore/TextIndicator.h>
64 #import <WebCore/TextUndoInsertionMarkupMac.h>
65 #import <WebKitSystemInterface.h>
66 #import <wtf/text/CString.h>
67 #import <wtf/text/WTFString.h>
69 #if USE(DICTATION_ALTERNATIVES)
70 #import <AppKit/NSTextAlternatives.h>
73 @interface NSApplication (WebNSApplicationDetails)
74 - (NSCursor *)_cursorRectCursor;
77 #if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
78 @interface NSWindow (WebNSWindowDetails)
79 - (BOOL)_hostsLayersInWindowServer;
83 SOFT_LINK_CONSTANT_MAY_FAIL(Lookup, LUTermOptionDisableSearchTermIndicator, NSString *)
85 using namespace WebCore;
86 using namespace WebKit;
88 @interface WKEditCommandObjC : NSObject
90 RefPtr<WebEditCommandProxy> m_command;
92 - (id)initWithWebEditCommandProxy:(PassRefPtr<WebEditCommandProxy>)command;
93 - (WebEditCommandProxy*)command;
96 @interface WKEditorUndoTargetObjC : NSObject
97 - (void)undoEditing:(id)sender;
98 - (void)redoEditing:(id)sender;
101 @implementation WKEditCommandObjC
103 - (id)initWithWebEditCommandProxy:(PassRefPtr<WebEditCommandProxy>)command
113 - (WebEditCommandProxy*)command
115 return m_command.get();
120 @implementation WKEditorUndoTargetObjC
122 - (void)undoEditing:(id)sender
124 ASSERT([sender isKindOfClass:[WKEditCommandObjC class]]);
125 [sender command]->unapply();
128 - (void)redoEditing:(id)sender
130 ASSERT([sender isKindOfClass:[WKEditCommandObjC class]]);
131 [sender command]->reapply();
138 PageClientImpl::PageClientImpl(WKView* wkView, WKWebView *webView)
141 , m_undoTarget(adoptNS([[WKEditorUndoTargetObjC alloc] init]))
142 #if USE(DICTATION_ALTERNATIVES)
143 , m_alternativeTextUIController(std::make_unique<AlternativeTextUIController>())
147 ASSERT_UNUSED(m_webView, !m_webView);
151 PageClientImpl::~PageClientImpl()
155 std::unique_ptr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy()
157 return [m_wkView _createDrawingAreaProxy];
160 void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect)
162 ASSERT_NOT_REACHED();
165 void PageClientImpl::displayView()
167 ASSERT_NOT_REACHED();
170 bool PageClientImpl::canScrollView()
175 void PageClientImpl::scrollView(const IntRect& scrollRect, const IntSize& scrollOffset)
177 ASSERT_NOT_REACHED();
180 void PageClientImpl::requestScroll(const FloatPoint& scrollPosition, bool isProgrammaticScroll)
182 ASSERT_NOT_REACHED();
185 IntSize PageClientImpl::viewSize()
187 return IntSize([m_wkView bounds].size);
190 NSView *PageClientImpl::activeView() const
193 return m_wkView._thumbnailView ? (NSView *)m_wkView._thumbnailView : (NSView *)m_wkView;
199 NSWindow *PageClientImpl::activeWindow() const
202 if (m_wkView._thumbnailView)
203 return m_wkView._thumbnailView.window;
205 if (m_wkView._targetWindowForMovePreparation)
206 return m_wkView._targetWindowForMovePreparation;
207 return m_wkView.window;
210 bool PageClientImpl::isViewWindowActive()
212 NSWindow *activeViewWindow = activeWindow();
213 return activeViewWindow.isKeyWindow || [NSApp keyWindow] == activeViewWindow;
216 bool PageClientImpl::isViewFocused()
218 return [m_wkView _isFocused];
221 void PageClientImpl::makeFirstResponder()
223 [[m_wkView window] makeFirstResponder:m_wkView];
226 bool PageClientImpl::isViewVisible()
228 NSView *activeView = this->activeView();
229 NSWindow *activeViewWindow = activeWindow();
231 if (!activeViewWindow)
234 if (!activeViewWindow.isVisible)
237 if (activeView.isHiddenOrHasHiddenAncestor)
240 if ([m_wkView windowOcclusionDetectionEnabled] && (activeViewWindow.occlusionState & NSWindowOcclusionStateVisible) != NSWindowOcclusionStateVisible)
246 bool PageClientImpl::isViewVisibleOrOccluded()
248 return activeWindow().isVisible;
251 bool PageClientImpl::isViewInWindow()
253 return activeWindow();
256 bool PageClientImpl::isVisuallyIdle()
258 return WindowServerConnection::singleton().applicationWindowModificationsHaveStopped() || !isViewVisible();
261 LayerHostingMode PageClientImpl::viewLayerHostingMode()
263 #if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
264 if ([activeWindow() _hostsLayersInWindowServer])
265 return LayerHostingMode::OutOfProcess;
267 return LayerHostingMode::InProcess;
270 void PageClientImpl::viewWillMoveToAnotherWindow()
272 clearAllEditCommands();
275 ColorSpaceData PageClientImpl::colorSpace()
277 return [m_wkView _colorSpace];
280 void PageClientImpl::processDidExit()
282 [m_wkView _processDidExit];
285 void PageClientImpl::pageClosed()
287 [m_wkView _pageClosed];
288 #if USE(DICTATION_ALTERNATIVES)
289 m_alternativeTextUIController->clear();
293 void PageClientImpl::didRelaunchProcess()
295 [m_wkView _didRelaunchProcess];
298 void PageClientImpl::preferencesDidChange()
300 [m_wkView _preferencesDidChange];
303 void PageClientImpl::toolTipChanged(const String& oldToolTip, const String& newToolTip)
305 [m_wkView _toolTipChangedFrom:nsStringFromWebCoreString(oldToolTip) to:nsStringFromWebCoreString(newToolTip)];
308 void PageClientImpl::didCommitLoadForMainFrame(const String& mimeType, bool useCustomContentProvider)
312 void PageClientImpl::didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference& dataReference)
316 void PageClientImpl::handleDownloadRequest(DownloadProxy* download)
318 ASSERT_ARG(download, download);
320 ASSERT([download->wrapper() isKindOfClass:[_WKDownload class]]);
321 [static_cast<_WKDownload *>(download->wrapper()) setOriginatingWebView:m_webView];
325 void PageClientImpl::setCursor(const WebCore::Cursor& cursor)
327 // FIXME: Would be nice to share this code with WebKit1's WebChromeClient.
329 if ([NSApp _cursorRectCursor])
335 NSWindow *window = [m_wkView window];
339 if ([window windowNumber] != [NSWindow windowNumberAtPoint:[NSEvent mouseLocation] belowWindowWithWindowNumber:0])
342 NSCursor *platformCursor = cursor.platformCursor();
343 if ([NSCursor currentCursor] == platformCursor)
346 [platformCursor set];
349 void PageClientImpl::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves)
351 [NSCursor setHiddenUntilMouseMoves:hiddenUntilMouseMoves];
354 void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttributes&)
358 void PageClientImpl::registerEditCommand(PassRefPtr<WebEditCommandProxy> prpCommand, WebPageProxy::UndoOrRedo undoOrRedo)
360 RefPtr<WebEditCommandProxy> command = prpCommand;
362 RetainPtr<WKEditCommandObjC> commandObjC = adoptNS([[WKEditCommandObjC alloc] initWithWebEditCommandProxy:command]);
363 String actionName = WebEditCommandProxy::nameForEditAction(command->editAction());
365 NSUndoManager *undoManager = [m_wkView undoManager];
366 [undoManager registerUndoWithTarget:m_undoTarget.get() selector:((undoOrRedo == WebPageProxy::Undo) ? @selector(undoEditing:) : @selector(redoEditing:)) object:commandObjC.get()];
367 if (!actionName.isEmpty())
368 [undoManager setActionName:(NSString *)actionName];
371 #if USE(INSERTION_UNDO_GROUPING)
372 void PageClientImpl::registerInsertionUndoGrouping()
374 registerInsertionUndoGroupingWithUndoManager([m_wkView undoManager]);
378 void PageClientImpl::clearAllEditCommands()
380 [[m_wkView undoManager] removeAllActionsWithTarget:m_undoTarget.get()];
383 bool PageClientImpl::canUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
385 return (undoOrRedo == WebPageProxy::Undo) ? [[m_wkView undoManager] canUndo] : [[m_wkView undoManager] canRedo];
388 void PageClientImpl::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo)
390 return (undoOrRedo == WebPageProxy::Undo) ? [[m_wkView undoManager] undo] : [[m_wkView undoManager] redo];
393 void PageClientImpl::setDragImage(const IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag)
395 RetainPtr<CGImageRef> dragCGImage = dragImage->makeCGImage();
396 RetainPtr<NSImage> dragNSImage = adoptNS([[NSImage alloc] initWithCGImage:dragCGImage.get() size:dragImage->size()]);
398 [m_wkView _setDragImage:dragNSImage.get() at:clientPosition linkDrag:isLinkDrag];
401 void PageClientImpl::setPromisedData(const String& pasteboardName, PassRefPtr<SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title, const String& url, const String& visibleUrl, PassRefPtr<SharedBuffer> archiveBuffer)
403 RefPtr<Image> image = BitmapImage::create();
404 image->setData(imageBuffer.get(), true);
405 [m_wkView _setPromisedData:image.get() withFileName:filename withExtension:extension withTitle:title withURL:url withVisibleURL:visibleUrl withArchive:archiveBuffer.get() forPasteboard:pasteboardName];
408 void PageClientImpl::updateSecureInputState()
410 [m_wkView _updateSecureInputState];
413 void PageClientImpl::resetSecureInputState()
415 [m_wkView _resetSecureInputState];
418 void PageClientImpl::notifyInputContextAboutDiscardedComposition()
420 [m_wkView _notifyInputContextAboutDiscardedComposition];
423 #if PLATFORM(MAC) && !USE(ASYNC_NSTEXTINPUTCLIENT)
424 void PageClientImpl::notifyApplicationAboutInputContextChange()
426 [NSApp updateWindows];
430 FloatRect PageClientImpl::convertToDeviceSpace(const FloatRect& rect)
432 return [m_wkView _convertToDeviceSpace:rect];
435 FloatRect PageClientImpl::convertToUserSpace(const FloatRect& rect)
437 return [m_wkView _convertToUserSpace:rect];
440 IntPoint PageClientImpl::screenToRootView(const IntPoint& point)
442 #pragma clang diagnostic push
443 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
444 NSPoint windowCoord = [[m_wkView window] convertScreenToBase:point];
445 #pragma clang diagnostic pop
446 return IntPoint([m_wkView convertPoint:windowCoord fromView:nil]);
449 IntRect PageClientImpl::rootViewToScreen(const IntRect& rect)
451 NSRect tempRect = rect;
452 tempRect = [m_wkView convertRect:tempRect toView:nil];
453 #pragma clang diagnostic push
454 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
455 tempRect.origin = [[m_wkView window] convertBaseToScreen:tempRect.origin];
456 #pragma clang diagnostic pop
457 return enclosingIntRect(tempRect);
460 void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool eventWasHandled)
462 [m_wkView _doneWithKeyEvent:event.nativeEvent() eventWasHandled:eventWasHandled];
465 PassRefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy* page)
467 return WebPopupMenuProxyMac::create(m_wkView, page);
470 PassRefPtr<WebContextMenuProxy> PageClientImpl::createContextMenuProxy(WebPageProxy* page)
472 return WebContextMenuProxyMac::create(m_wkView, page);
475 #if ENABLE(INPUT_TYPE_COLOR)
476 PassRefPtr<WebColorPicker> PageClientImpl::createColorPicker(WebPageProxy* page, const WebCore::Color& initialColor, const WebCore::IntRect& rect)
478 return WebColorPickerMac::create(page, initialColor, rect, wkView());
482 void PageClientImpl::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, bool fadeOut)
484 [m_wkView _setTextIndicator:textIndicator fadeOut:fadeOut];
487 void PageClientImpl::setTextIndicatorAnimationProgress(float progress)
489 [m_wkView _setTextIndicatorAnimationProgress:progress];
492 void PageClientImpl::accessibilityWebProcessTokenReceived(const IPC::DataReference& data)
494 NSData* remoteToken = [NSData dataWithBytes:data.data() length:data.size()];
495 [m_wkView _setAccessibilityWebProcessToken:remoteToken];
498 void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
500 ASSERT(!layerTreeContext.isEmpty());
502 CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
503 [m_wkView _setAcceleratedCompositingModeRootLayer:renderLayer];
506 void PageClientImpl::exitAcceleratedCompositingMode()
508 [m_wkView _setAcceleratedCompositingModeRootLayer:nil];
511 void PageClientImpl::updateAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
513 ASSERT(!layerTreeContext.isEmpty());
515 CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
516 [m_wkView _setAcceleratedCompositingModeRootLayer:renderLayer];
519 void PageClientImpl::setAcceleratedCompositingRootLayer(CALayer *rootLayer)
521 [m_wkView _setAcceleratedCompositingModeRootLayer:rootLayer];
524 CALayer *PageClientImpl::acceleratedCompositingRootLayer() const
526 return m_wkView._acceleratedCompositingModeRootLayer;
529 PassRefPtr<ViewSnapshot> PageClientImpl::takeViewSnapshot()
531 return [m_wkView _takeViewSnapshot];
534 void PageClientImpl::selectionDidChange()
536 [m_wkView _selectionChanged];
539 void PageClientImpl::wheelEventWasNotHandledByWebCore(const NativeWebWheelEvent& event)
541 [m_wkView _wheelEventWasNotHandledByWebCore:event.nativeEvent()];
544 void PageClientImpl::pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus)
546 [m_wkView _pluginFocusOrWindowFocusChanged:pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier];
549 void PageClientImpl::setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState pluginComplexTextInputState)
551 [m_wkView _setPluginComplexTextInputState:pluginComplexTextInputState pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier];
554 void PageClientImpl::didPerformDictionaryLookup(const DictionaryPopupInfo& dictionaryPopupInfo)
556 if (!getLULookupDefinitionModuleClass())
559 NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
561 // Convert to screen coordinates.
562 textBaselineOrigin = [m_wkView convertPoint:textBaselineOrigin toView:nil];
563 textBaselineOrigin = [m_wkView.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin;
565 RetainPtr<NSMutableDictionary> mutableOptions = adoptNS([(NSDictionary *)dictionaryPopupInfo.options.get() mutableCopy]);
567 if (canLoadLUTermOptionDisableSearchTermIndicator() && dictionaryPopupInfo.textIndicator.contentImage) {
568 [m_wkView _setTextIndicator:TextIndicator::create(dictionaryPopupInfo.textIndicator) fadeOut:NO];
569 [mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()];
570 [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.string.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
572 [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.string.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
575 void PageClientImpl::dismissContentRelativeChildWindows()
577 [m_wkView _dismissContentRelativeChildWindows];
580 void PageClientImpl::showCorrectionPanel(AlternativeTextType type, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
582 #if USE(AUTOCORRECTION_PANEL)
583 if (!isViewVisible() || !isViewInWindow())
585 m_correctionPanel.show(m_wkView, type, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
589 void PageClientImpl::dismissCorrectionPanel(ReasonForDismissingAlternativeText reason)
591 #if USE(AUTOCORRECTION_PANEL)
592 m_correctionPanel.dismiss(reason);
596 String PageClientImpl::dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAlternativeText reason)
598 #if USE(AUTOCORRECTION_PANEL)
599 return m_correctionPanel.dismiss(reason);
605 void PageClientImpl::recordAutocorrectionResponse(AutocorrectionResponseType responseType, const String& replacedString, const String& replacementString)
607 NSCorrectionResponse response = responseType == AutocorrectionReverted ? NSCorrectionResponseReverted : NSCorrectionResponseEdited;
608 CorrectionPanel::recordAutocorrectionResponse(m_wkView, response, replacedString, replacementString);
611 void PageClientImpl::recommendedScrollbarStyleDidChange(ScrollbarStyle newStyle)
613 // Now re-create a tracking area with the appropriate options given the new scrollbar style
614 NSTrackingAreaOptions options = NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect;
615 if (newStyle == ScrollbarStyle::AlwaysVisible)
616 options |= NSTrackingActiveAlways;
618 options |= NSTrackingActiveInKeyWindow;
620 RetainPtr<NSTrackingArea> trackingArea = adoptNS([[NSTrackingArea alloc] initWithRect:[m_wkView frame] options:options owner:m_wkView userInfo:nil]);
621 [m_wkView _setPrimaryTrackingArea:trackingArea.get()];
624 void PageClientImpl::intrinsicContentSizeDidChange(const IntSize& intrinsicContentSize)
626 [m_wkView _setIntrinsicContentSize:intrinsicContentSize];
629 bool PageClientImpl::executeSavedCommandBySelector(const String& selectorString)
631 return [m_wkView _executeSavedCommandBySelector:NSSelectorFromString(selectorString)];
634 #if USE(DICTATION_ALTERNATIVES)
635 uint64_t PageClientImpl::addDictationAlternatives(const RetainPtr<NSTextAlternatives>& alternatives)
637 return m_alternativeTextUIController->addAlternatives(alternatives);
640 void PageClientImpl::removeDictationAlternatives(uint64_t dictationContext)
642 m_alternativeTextUIController->removeAlternatives(dictationContext);
645 void PageClientImpl::showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext)
647 if (!isViewVisible() || !isViewInWindow())
649 m_alternativeTextUIController->showAlternatives(m_wkView, boundingBoxOfDictatedText, dictationContext, ^(NSString* acceptedAlternative){
650 [m_wkView handleAcceptedAlternativeText:acceptedAlternative];
654 Vector<String> PageClientImpl::dictationAlternatives(uint64_t dictationContext)
656 return m_alternativeTextUIController->alternativesForContext(dictationContext);
660 #if ENABLE(FULLSCREEN_API)
662 WebFullScreenManagerProxyClient& PageClientImpl::fullScreenManagerProxyClient()
667 // WebFullScreenManagerProxyClient
669 void PageClientImpl::closeFullScreenManager()
671 [m_wkView _closeFullScreenWindowController];
674 bool PageClientImpl::isFullScreen()
676 if (!m_wkView._hasFullScreenWindowController)
679 return m_wkView._fullScreenWindowController.isFullScreen;
682 void PageClientImpl::enterFullScreen()
684 [m_wkView._fullScreenWindowController enterFullScreen:nil];
687 void PageClientImpl::exitFullScreen()
689 [m_wkView._fullScreenWindowController exitFullScreen];
692 void PageClientImpl::beganEnterFullScreen(const IntRect& initialFrame, const IntRect& finalFrame)
694 [m_wkView._fullScreenWindowController beganEnterFullScreenWithInitialFrame:initialFrame finalFrame:finalFrame];
697 void PageClientImpl::beganExitFullScreen(const IntRect& initialFrame, const IntRect& finalFrame)
699 [m_wkView._fullScreenWindowController beganExitFullScreenWithInitialFrame:initialFrame finalFrame:finalFrame];
702 #endif // ENABLE(FULLSCREEN_API)
704 void PageClientImpl::navigationGestureDidBegin()
706 dismissContentRelativeChildWindows();
710 NavigationState::fromWebPage(*m_webView->_page).navigationGestureDidBegin();
714 void PageClientImpl::navigationGestureWillEnd(bool willNavigate, WebBackForwardListItem& item)
718 NavigationState::fromWebPage(*m_webView->_page).navigationGestureWillEnd(willNavigate, item);
720 UNUSED_PARAM(willNavigate);
725 void PageClientImpl::navigationGestureDidEnd(bool willNavigate, WebBackForwardListItem& item)
729 NavigationState::fromWebPage(*m_webView->_page).navigationGestureDidEnd(willNavigate, item);
731 UNUSED_PARAM(willNavigate);
736 void PageClientImpl::willRecordNavigationSnapshot(WebBackForwardListItem& item)
740 NavigationState::fromWebPage(*m_webView->_page).willRecordNavigationSnapshot(item);
746 void PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame()
748 [m_wkView _didFirstVisuallyNonEmptyLayoutForMainFrame];
751 void PageClientImpl::didFinishLoadForMainFrame()
753 [m_wkView _didFinishLoadForMainFrame];
756 void PageClientImpl::didSameDocumentNavigationForMainFrame(SameDocumentNavigationType type)
758 [m_wkView _didSameDocumentNavigationForMainFrame:type];
761 void PageClientImpl::removeNavigationGestureSnapshot()
763 [m_wkView _removeNavigationGestureSnapshot];
766 CGRect PageClientImpl::boundsOfLayerInLayerBackedWindowCoordinates(CALayer *layer) const
768 CALayer *windowContentLayer = static_cast<NSView *>(m_wkView.window.contentView).layer;
769 ASSERT(windowContentLayer);
771 return [windowContentLayer convertRect:layer.bounds fromLayer:layer];
774 void PageClientImpl::didPerformActionMenuHitTest(const ActionMenuHitTestResult& result, bool forImmediateAction, API::Object* userData)
776 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
777 [m_wkView _didPerformActionMenuHitTest:result forImmediateAction:forImmediateAction userData:userData];
781 void PageClientImpl::showPlatformContextMenu(NSMenu *menu, IntPoint location)
783 [menu popUpMenuPositioningItem:nil atLocation:location inView:m_wkView];
787 } // namespace WebKit
789 #endif // PLATFORM(MAC)