diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
commit | cfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch) | |
tree | 24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/WebKit2/UIProcess/API/mac | |
parent | 69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff) | |
download | qtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz |
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Source/WebKit2/UIProcess/API/mac')
-rw-r--r-- | Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm | 70 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/API/mac/WKConnection.h | 2 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/API/mac/WKConnection.mm | 30 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/API/mac/WKView.mm | 423 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/API/mac/WKViewInternal.h | 97 | ||||
-rw-r--r-- | Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h | 6 |
6 files changed, 329 insertions, 299 deletions
diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm index ba88107e1..7b54b4bd7 100644 --- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm +++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm @@ -139,7 +139,7 @@ PageClientImpl::~PageClientImpl() PassOwnPtr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy() { - return [m_wkView _wk_createDrawingAreaProxy]; + return [m_wkView _createDrawingAreaProxy]; } void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect) @@ -156,7 +156,7 @@ void PageClientImpl::scrollView(const IntRect& scrollRect, const IntSize& scroll { NSRect clippedScrollRect = NSIntersectionRect(scrollRect, NSOffsetRect(scrollRect, -scrollOffset.width(), -scrollOffset.height())); - [m_wkView _wk_cacheWindowBottomCornerRect]; + [m_wkView _cacheWindowBottomCornerRect]; [m_wkView translateRectsNeedingDisplayInRect:clippedScrollRect by:scrollOffset]; [m_wkView scrollRect:clippedScrollRect by:scrollOffset]; @@ -174,7 +174,7 @@ bool PageClientImpl::isViewWindowActive() bool PageClientImpl::isViewFocused() { - return [m_wkView _wk_isFocused]; + return [m_wkView _isFocused]; } void PageClientImpl::makeFirstResponder() @@ -220,17 +220,17 @@ LayerHostingMode PageClientImpl::viewLayerHostingMode() ColorSpaceData PageClientImpl::colorSpace() { - return [m_wkView _wk_colorSpace]; + return [m_wkView _colorSpace]; } void PageClientImpl::processDidCrash() { - [m_wkView _wk_processDidCrash]; + [m_wkView _processDidCrash]; } void PageClientImpl::pageClosed() { - [m_wkView _wk_pageClosed]; + [m_wkView _pageClosed]; #if USE(DICTATION_ALTERNATIVES) m_alternativeTextUIController->clear(); #endif @@ -238,18 +238,18 @@ void PageClientImpl::pageClosed() void PageClientImpl::didRelaunchProcess() { - [m_wkView _wk_didRelaunchProcess]; + [m_wkView _didRelaunchProcess]; } void PageClientImpl::toolTipChanged(const String& oldToolTip, const String& newToolTip) { - [m_wkView _wk_toolTipChangedFrom:nsStringFromWebCoreString(oldToolTip) to:nsStringFromWebCoreString(newToolTip)]; + [m_wkView _toolTipChangedFrom:nsStringFromWebCoreString(oldToolTip) to:nsStringFromWebCoreString(newToolTip)]; } void PageClientImpl::setCursor(const WebCore::Cursor& cursor) { if (![NSApp _cursorRectCursor]) - [m_wkView _wk_setCursor:cursor.platformCursor()]; + [m_wkView _setCursor:cursor.platformCursor()]; } void PageClientImpl::setCursorHiddenUntilMouseMoves(bool hiddenUntilMouseMoves) @@ -291,7 +291,7 @@ void PageClientImpl::executeUndoRedo(WebPageProxy::UndoOrRedo undoOrRedo) bool PageClientImpl::interpretKeyEvent(const NativeWebKeyboardEvent& event, Vector<WebCore::KeypressCommand>& commands) { - return [m_wkView _wk_interpretKeyEvent:event.nativeEvent() savingCommandsTo:commands]; + return [m_wkView _interpretKeyEvent:event.nativeEvent() savingCommandsTo:commands]; } void PageClientImpl::setDragImage(const IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) @@ -299,34 +299,34 @@ void PageClientImpl::setDragImage(const IntPoint& clientPosition, PassRefPtr<Sha RetainPtr<CGImageRef> dragCGImage = dragImage->makeCGImage(); RetainPtr<NSImage> dragNSImage(AdoptNS, [[NSImage alloc] initWithCGImage:dragCGImage.get() size:dragImage->size()]); - [m_wkView _wk_setDragImage:dragNSImage.get() at:clientPosition linkDrag:isLinkDrag]; + [m_wkView _setDragImage:dragNSImage.get() at:clientPosition linkDrag:isLinkDrag]; } 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) { RefPtr<Image> image = BitmapImage::create(); image->setData(imageBuffer.get(), true); - [m_wkView _wk_setPromisedData:image.get() withFileName:filename withExtension:extension withTitle:title withURL:url withVisibleURL:visibleUrl withArchive:archiveBuffer.get() forPasteboard:pasteboardName]; + [m_wkView _setPromisedData:image.get() withFileName:filename withExtension:extension withTitle:title withURL:url withVisibleURL:visibleUrl withArchive:archiveBuffer.get() forPasteboard:pasteboardName]; } void PageClientImpl::updateTextInputState(bool updateSecureInputState) { - [m_wkView _wk_updateTextInputStateIncludingSecureInputState:updateSecureInputState]; + [m_wkView _updateTextInputStateIncludingSecureInputState:updateSecureInputState]; } void PageClientImpl::resetTextInputState() { - [m_wkView _wk_resetTextInputState]; + [m_wkView _resetTextInputState]; } FloatRect PageClientImpl::convertToDeviceSpace(const FloatRect& rect) { - return [m_wkView _wk_convertToDeviceSpace:rect]; + return [m_wkView _convertToDeviceSpace:rect]; } FloatRect PageClientImpl::convertToUserSpace(const FloatRect& rect) { - return [m_wkView _wk_convertToUserSpace:rect]; + return [m_wkView _convertToUserSpace:rect]; } IntPoint PageClientImpl::screenToWindow(const IntPoint& point) @@ -352,7 +352,7 @@ void PageClientImpl::doneWithGestureEvent(const WebGestureEvent&, bool wasEventH void PageClientImpl::doneWithKeyEvent(const NativeWebKeyboardEvent& event, bool eventWasHandled) { - [m_wkView _wk_doneWithKeyEvent:event.nativeEvent() eventWasHandled:eventWasHandled]; + [m_wkView _doneWithKeyEvent:event.nativeEvent() eventWasHandled:eventWasHandled]; } PassRefPtr<WebPopupMenuProxy> PageClientImpl::createPopupMenuProxy(WebPageProxy* page) @@ -375,40 +375,40 @@ PassRefPtr<WebColorChooserProxy> PageClientImpl::createColorChooserProxy(WebPage void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut, bool animate) { - [m_wkView _wk_setFindIndicator:findIndicator fadeOut:fadeOut animate:animate]; + [m_wkView _setFindIndicator:findIndicator fadeOut:fadeOut animate:animate]; } void PageClientImpl::accessibilityWebProcessTokenReceived(const CoreIPC::DataReference& data) { - NSData *remoteToken = [NSData dataWithBytes:data.data() length:data.size()]; - [m_wkView _wk_setAccessibilityWebProcessToken:remoteToken]; + NSData* remoteToken = [NSData dataWithBytes:data.data() length:data.size()]; + [m_wkView _setAccessibilityWebProcessToken:remoteToken]; } #if USE(ACCELERATED_COMPOSITING) void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext) { - [m_wkView _wk_enterAcceleratedCompositingMode:layerTreeContext]; + [m_wkView _enterAcceleratedCompositingMode:layerTreeContext]; } void PageClientImpl::exitAcceleratedCompositingMode() { - [m_wkView _wk_exitAcceleratedCompositingMode]; + [m_wkView _exitAcceleratedCompositingMode]; } void PageClientImpl::updateAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext) { - [m_wkView _wk_updateAcceleratedCompositingMode:layerTreeContext]; + [m_wkView _updateAcceleratedCompositingMode:layerTreeContext]; } #endif // USE(ACCELERATED_COMPOSITING) void PageClientImpl::pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus) { - [m_wkView _wk_pluginFocusOrWindowFocusChanged:pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier]; + [m_wkView _pluginFocusOrWindowFocusChanged:pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier]; } void PageClientImpl::setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState pluginComplexTextInputState) { - [m_wkView _wk_setPluginComplexTextInputState:pluginComplexTextInputState pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier]; + [m_wkView _setPluginComplexTextInputState:pluginComplexTextInputState pluginComplexTextInputIdentifier:pluginComplexTextInputIdentifier]; } CGContextRef PageClientImpl::containingWindowGraphicsContext() @@ -424,37 +424,37 @@ CGContextRef PageClientImpl::containingWindowGraphicsContext() void PageClientImpl::didChangeScrollbarsForMainFrame() const { - [m_wkView _wk_didChangeScrollbarsForMainFrame]; + [m_wkView _didChangeScrollbarsForMainFrame]; } void PageClientImpl::didCommitLoadForMainFrame(bool useCustomRepresentation) { - [m_wkView _wk_setPageHasCustomRepresentation:useCustomRepresentation]; + [m_wkView _setPageHasCustomRepresentation:useCustomRepresentation]; } void PageClientImpl::didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference& dataReference) { - [m_wkView _wk_didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:suggestedFilename dataReference:dataReference]; + [m_wkView _didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:suggestedFilename dataReference:dataReference]; } double PageClientImpl::customRepresentationZoomFactor() { - return [m_wkView _wk_customRepresentationZoomFactor]; + return [m_wkView _customRepresentationZoomFactor]; } void PageClientImpl::setCustomRepresentationZoomFactor(double zoomFactor) { - [m_wkView _wk_setCustomRepresentationZoomFactor:zoomFactor]; + [m_wkView _setCustomRepresentationZoomFactor:zoomFactor]; } void PageClientImpl::findStringInCustomRepresentation(const String& string, FindOptions options, unsigned maxMatchCount) { - [m_wkView _wk_findStringInCustomRepresentation:string withFindOptions:options maxMatchCount:maxMatchCount]; + [m_wkView _findStringInCustomRepresentation:string withFindOptions:options maxMatchCount:maxMatchCount]; } void PageClientImpl::countStringMatchesInCustomRepresentation(const String& string, FindOptions options, unsigned maxMatchCount) { - [m_wkView _wk_countStringMatchesInCustomRepresentation:string withFindOptions:options maxMatchCount:maxMatchCount]; + [m_wkView _countStringMatchesInCustomRepresentation:string withFindOptions:options maxMatchCount:maxMatchCount]; } void PageClientImpl::flashBackingStoreUpdates(const Vector<IntRect>&) @@ -555,11 +555,10 @@ void PageClientImpl::recommendedScrollbarStyleDidChange(int32_t newStyle) bool PageClientImpl::executeSavedCommandBySelector(const String& selectorString) { - return [m_wkView _wk_executeSavedCommandBySelector:NSSelectorFromString(selectorString)]; + return [m_wkView _executeSavedCommandBySelector:NSSelectorFromString(selectorString)]; } #if USE(DICTATION_ALTERNATIVES) - uint64_t PageClientImpl::addDictationAlternatives(const RetainPtr<NSTextAlternatives>& alternatives) { return m_alternativeTextUIController->addAlternatives(alternatives); @@ -575,7 +574,7 @@ void PageClientImpl::showDictationAlternativeUI(const WebCore::FloatRect& boundi if (!isViewVisible() || !isViewInWindow()) return; m_alternativeTextUIController->showAlternatives(m_wkView, boundingBoxOfDictatedText, dictationContext, ^(NSString* acceptedAlternative){ - [m_wkView _wk_handleAcceptedAlternativeText:acceptedAlternative]; + [m_wkView handleAcceptedAlternativeText:acceptedAlternative]; }); } @@ -588,7 +587,6 @@ void PageClientImpl::dismissDictationAlternativeUI() { m_alternativeTextUIController->dismissAlternatives(); } - #endif } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/API/mac/WKConnection.h b/Source/WebKit2/UIProcess/API/mac/WKConnection.h index bf582b303..52bd85c66 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKConnection.h +++ b/Source/WebKit2/UIProcess/API/mac/WKConnection.h @@ -41,6 +41,8 @@ WK_EXPORT WKConnectionData *_data; } +- (void)sendMessageWithName:(NSString *)messageName body:(id)messageBody; + #pragma mark Delegates @property(assign) id<WKConnectionDelegate> delegate; diff --git a/Source/WebKit2/UIProcess/API/mac/WKConnection.mm b/Source/WebKit2/UIProcess/API/mac/WKConnection.mm index 626ec85e6..8040a6781 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKConnection.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKConnection.mm @@ -27,11 +27,18 @@ #import "WKConnection.h" #import "WKConnectionInternal.h" +#import "ArgumentCodersMac.h" +#import "ArgumentDecoder.h" +#import "ArgumentEncoder.h" #import "WKConnectionRef.h" +#import "WKData.h" #import "WKRetainPtr.h" +#import "WKString.h" #import "WKStringCF.h" #import <wtf/RetainPtr.h> +using namespace WebKit; + @interface WKConnectionData : NSObject { @public // Underlying connection object. @@ -55,6 +62,17 @@ [super dealloc]; } +- (void)sendMessageWithName:(NSString *)messageName body:(id)messageBody +{ + OwnPtr<CoreIPC::ArgumentEncoder> messageData = CoreIPC::ArgumentEncoder::create(); + encode(*messageData, messageBody); + + WKRetainPtr<WKStringRef> wkMessageName = adoptWK(WKStringCreateWithCFString((CFStringRef)messageName)); + WKRetainPtr<WKDataRef> wkMessageBody = adoptWK(WKDataCreate(messageData->buffer(), messageData->bufferSize())); + + WKConnectionPostMessage(_data->_connectionRef.get(), wkMessageName.get(), wkMessageBody.get()); +} + #pragma mark Delegates - (id<WKConnectionDelegate>)delegate @@ -75,9 +93,17 @@ static void didReceiveMessage(WKConnectionRef, WKStringRef messageName, WKTypeRe { WKConnection *connection = (WKConnection *)clientInfo; if ([connection.delegate respondsToSelector:@selector(connection:didReceiveMessageWithName:body:)]) { - // FIXME: Add messageBody conversion. RetainPtr<CFStringRef> cfMessageName = adoptCF(WKStringCopyCFString(kCFAllocatorDefault, messageName)); - [connection.delegate connection:connection didReceiveMessageWithName:(NSString *)cfMessageName.get() body:nil]; + + WKDataRef messageData = (WKDataRef)messageBody; + OwnPtr<CoreIPC::ArgumentDecoder> decoder = CoreIPC::ArgumentDecoder::create(WKDataGetBytes(messageData), WKDataGetSize(messageData)); + + RetainPtr<id> messageDictionary; + // FIXME: Don't just silently drop decoding failures on the ground. + if (!decode(decoder.get(), messageDictionary)) + return; + + [connection.delegate connection:connection didReceiveMessageWithName:(NSString *)cfMessageName.get() body:messageDictionary.get()]; } } diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm index ac037fb30..5fd169c84 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKView.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,6 +26,11 @@ #import "config.h" #import "WKView.h" +#if USE(DICTATION_ALTERNATIVES) +#import <AppKit/NSTextAlternatives.h> +#import <AppKit/NSAttributedString.h> +#endif + #import "AttributedString.h" #import "ColorSpaceData.h" #import "DataReference.h" @@ -41,16 +46,14 @@ #import "PDFViewController.h" #import "PageClientImpl.h" #import "PasteboardTypes.h" +#import "RemoteLayerTreeDrawingAreaProxy.h" #import "StringUtilities.h" #import "TextChecker.h" #import "TextCheckerState.h" #import "TiledCoreAnimationDrawingAreaProxy.h" #import "WKAPICast.h" -#import "WKBrowsingContextControllerInternal.h" -#import "WKBrowsingContextGroupInternal.h" #import "WKFullScreenWindowController.h" #import "WKPrintingView.h" -#import "WKProcessGroupInternal.h" #import "WKStringCF.h" #import "WKTextInputWindowController.h" #import "WKViewInternal.h" @@ -67,7 +70,6 @@ #import <WebCore/DragController.h> #import <WebCore/DragData.h> #import <WebCore/DragSession.h> -#import <WebCore/FileSystem.h> #import <WebCore/FloatRect.h> #import <WebCore/Image.h> #import <WebCore/IntRect.h> @@ -80,14 +82,17 @@ #import <WebCore/SharedBuffer.h> #import <WebCore/TextAlternativeWithRange.h> #import <WebCore/WebCoreNSStringExtras.h> +#import <WebCore/FileSystem.h> #import <WebKitSystemInterface.h> #import <sys/stat.h> #import <wtf/RefPtr.h> #import <wtf/RetainPtr.h> -#if USE(DICTATION_ALTERNATIVES) -#import <AppKit/NSTextAlternatives.h> -#endif +/* API internals. */ +#import "WKBrowsingContextControllerInternal.h" +#import "WKBrowsingContextGroupInternal.h" +#import "WKProcessGroupInternal.h" + @interface NSApplication (WKNSApplicationDetails) - (void)speakString:(NSString *)string; @@ -130,12 +135,13 @@ struct WKViewInterpretKeyEventsParameters { }; @interface WKView () -- (void)_wk_accessibilityRegisterUIProcessTokens; -- (void)_wk_disableComplexTextInputIfNecessary; -- (float)_wk_intrinsicDeviceScaleFactor; -- (void)_wk_postFakeMouseMovedEventForFlagsChangedEvent:(NSEvent *)flagsChangedEvent; -- (void)_wk_setDrawingAreaSize:(NSSize)size; -- (void)_wk_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState; +- (void)_accessibilityRegisterUIProcessTokens; +- (void)_disableComplexTextInputIfNecessary; +- (float)_intrinsicDeviceScaleFactor; +- (void)_postFakeMouseMovedEventForFlagsChangedEvent:(NSEvent *)flagsChangedEvent; +- (void)_setDrawingAreaSize:(NSSize)size; +- (void)_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState; +- (BOOL)_shouldUseTiledDrawingArea; @end @interface WKViewData : NSObject { @@ -209,8 +215,6 @@ struct WKViewInterpretKeyEventsParameters { RefPtr<WebCore::Image> _promisedImage; String _promisedFilename; String _promisedURL; - - RetainPtr<NSMutableArray> _observers; } @end @@ -218,6 +222,7 @@ struct WKViewInterpretKeyEventsParameters { @implementation WKViewData @end + @interface WKResponderChainSink : NSResponder { NSResponder *_lastResponderInChain; bool _didReceiveUnhandledCommand; @@ -303,7 +308,7 @@ struct WKViewInterpretKeyEventsParameters { _data->_inBecomeFirstResponder = true; - [self _wk_updateSecureInputState]; + [self _updateSecureInputState]; _data->_page->viewStateDidChange(WebPageProxy::ViewIsFocused); _data->_inBecomeFirstResponder = false; @@ -324,7 +329,7 @@ struct WKViewInterpretKeyEventsParameters { if (_data->_page->editorState().hasComposition && !_data->_page->editorState().shouldIgnoreCompositionSelectionChange) _data->_page->cancelComposition(); - [self _wk_resetTextInputState]; + [self _resetTextInputState]; if (!_data->_page->maintainsInactiveSelection()) _data->_page->clearSelection(); @@ -359,10 +364,10 @@ struct WKViewInterpretKeyEventsParameters { [super setFrameSize:size]; if (![self frameSizeUpdatesDisabled]) - [self _wk_setDrawingAreaSize:size]; + [self _setDrawingAreaSize:size]; } -- (void)_wk_updateWindowAndViewFrames +- (void)_updateWindowAndViewFrames { NSWindow *window = [self window]; ASSERT(window); @@ -381,12 +386,12 @@ struct WKViewInterpretKeyEventsParameters { // Update the view frame. if ([self window]) - [self _wk_updateWindowAndViewFrames]; + [self _updateWindowAndViewFrames]; [super renewGState]; } -- (void)_wk_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState +- (void)_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState { _data->_pluginComplexTextInputState = pluginComplexTextInputState; @@ -649,7 +654,7 @@ static void validateCommandCallback(WKStringRef commandName, bool isEnabled, int WKView* wkView = static_cast<WKView*>(context); ASSERT(wkView); - [wkView _wk_setUserInterfaceItemState:nsStringFromWebCoreString(toImpl(commandName)->string()) enabled:isEnabled state:state]; + [wkView _setUserInterfaceItemState:nsStringFromWebCoreString(toImpl(commandName)->string()) enabled:isEnabled state:state]; } - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item @@ -960,7 +965,7 @@ static void speakString(WKStringRef string, WKErrorRef error, void*) { #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // FIXME: We should remove this code when <rdar://problem/9362085> is resolved. In the meantime, - // it is necessary to disable screen updates so we get a chance to redraw the corners before this + // it is necessary to disable scren updates so we get a chance to redraw the corners before this // display is visible. NSWindow *window = [self window]; BOOL shouldMaskWindow = window && !NSIsEmptyRect(_data->_windowBottomCornerIntersectionRect); @@ -988,7 +993,7 @@ static void speakString(WKStringRef string, WKErrorRef error, void*) return YES; } -- (void)_wk_setMouseDownEvent:(NSEvent *)event +- (void)_setMouseDownEvent:(NSEvent *)event { ASSERT(!event || [event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown); @@ -1012,10 +1017,10 @@ static void speakString(WKStringRef string, WKErrorRef error, void*) NATIVE_MOUSE_EVENT_HANDLER(mouseEntered) NATIVE_MOUSE_EVENT_HANDLER(mouseExited) -NATIVE_MOUSE_EVENT_HANDLER(_wk_mouseMovedInternal) -NATIVE_MOUSE_EVENT_HANDLER(_wk_mouseDownInternal) -NATIVE_MOUSE_EVENT_HANDLER(_wk_mouseUpInternal) -NATIVE_MOUSE_EVENT_HANDLER(_wk_mouseDraggedInternal) +NATIVE_MOUSE_EVENT_HANDLER(mouseMovedInternal) +NATIVE_MOUSE_EVENT_HANDLER(mouseDownInternal) +NATIVE_MOUSE_EVENT_HANDLER(mouseUpInternal) +NATIVE_MOUSE_EVENT_HANDLER(mouseDraggedInternal) NATIVE_MOUSE_EVENT_HANDLER(otherMouseDown) NATIVE_MOUSE_EVENT_HANDLER(otherMouseDragged) NATIVE_MOUSE_EVENT_HANDLER(otherMouseMoved) @@ -1043,27 +1048,27 @@ NATIVE_EVENT_HANDLER(scrollWheel, Wheel) if (self == [[self window] firstResponder] && !NSPointInRect([self convertPoint:[event locationInWindow] fromView:nil], [self visibleRect])) return; - [self _wk_mouseMovedInternal:event]; + [self mouseMovedInternal:event]; } - (void)mouseDown:(NSEvent *)event { - [self _wk_setMouseDownEvent:event]; + [self _setMouseDownEvent:event]; _data->_ignoringMouseDraggedEvents = NO; - [self _wk_mouseDownInternal:event]; + [self mouseDownInternal:event]; } - (void)mouseUp:(NSEvent *)event { - [self _wk_setMouseDownEvent:nil]; - [self _wk_mouseUpInternal:event]; + [self _setMouseDownEvent:nil]; + [self mouseUpInternal:event]; } - (void)mouseDragged:(NSEvent *)event { if (_data->_ignoringMouseDraggedEvents) return; - [self _wk_mouseDraggedInternal:event]; + [self mouseDraggedInternal:event]; } - (BOOL)acceptsFirstMouse:(NSEvent *)event @@ -1076,9 +1081,9 @@ NATIVE_EVENT_HANDLER(scrollWheel, Wheel) if (![self hitTest:[event locationInWindow]]) return NO; - [self _wk_setMouseDownEvent:event]; + [self _setMouseDownEvent:event]; bool result = _data->_page->acceptsFirstMouse([event eventNumber], WebEventFactory::createWebMouseEvent(event, self)); - [self _wk_setMouseDownEvent:nil]; + [self _setMouseDownEvent:nil]; return result; } @@ -1097,9 +1102,9 @@ NATIVE_EVENT_HANDLER(scrollWheel, Wheel) if (![self hitTest:[event locationInWindow]]) return NO; - [self _wk_setMouseDownEvent:event]; + [self _setMouseDownEvent:event]; bool result = _data->_page->shouldDelayWindowOrderingForEvent(WebEventFactory::createWebMouseEvent(event, self)); - [self _wk_setMouseDownEvent:nil]; + [self _setMouseDownEvent:nil]; return result; } @@ -1136,7 +1141,6 @@ static const short kIOHIDEventTypeScroll = 6; }]; } } - #endif - (void)doCommandBySelector:(SEL)selector @@ -1223,7 +1227,7 @@ static const short kIOHIDEventTypeScroll = 6; parameters->eventInterpretationHadSideEffects |= eventHandled; } -- (BOOL)_wk_handleStyleKeyEquivalent:(NSEvent *)event +- (BOOL)_handleStyleKeyEquivalent:(NSEvent *)event { if (!_data->_page->editorState().isContentEditable) return NO; @@ -1259,7 +1263,7 @@ static const short kIOHIDEventTypeScroll = 6; BOOL eventWasSentToWebCore = (_data->_keyDownEventBeingResent == event); if (!eventWasSentToWebCore) - [self _wk_disableComplexTextInputIfNecessary]; + [self _disableComplexTextInputIfNecessary]; // Pass key combos through WebCore if there is a key binding available for // this event. This lets web pages have a crack at intercepting key-modified keypresses. @@ -1270,7 +1274,7 @@ static const short kIOHIDEventTypeScroll = 6; return YES; } - return [self _wk_handleStyleKeyEquivalent:event] || [super performKeyEquivalent:event]; + return [self _handleStyleKeyEquivalent:event] || [super performKeyEquivalent:event]; } - (void)keyUp:(NSEvent *)theEvent @@ -1279,7 +1283,7 @@ static const short kIOHIDEventTypeScroll = 6; _data->_page->handleKeyboardEvent(NativeWebKeyboardEvent(theEvent, self)); } -- (void)_wk_disableComplexTextInputIfNecessary +- (void)_disableComplexTextInputIfNecessary { if (!_data->_pluginComplexTextInputIdentifier) return; @@ -1289,10 +1293,10 @@ static const short kIOHIDEventTypeScroll = 6; // Check if the text input window has been dismissed. if (![[WKTextInputWindowController sharedTextInputWindowController] hasMarkedText]) - [self _wk_setPluginComplexTextInputState:PluginComplexTextInputDisabled]; + [self _setPluginComplexTextInputState:PluginComplexTextInputDisabled]; } -- (BOOL)_wk_handlePluginComplexTextInputKeyDown:(NSEvent *)event +- (BOOL)_handlePluginComplexTextInputKeyDown:(NSEvent *)event { ASSERT(_data->_pluginComplexTextInputIdentifier); ASSERT(_data->_pluginComplexTextInputState != PluginComplexTextInputDisabled); @@ -1312,18 +1316,18 @@ static const short kIOHIDEventTypeScroll = 6; return didHandleEvent; } -- (BOOL)_wk_tryHandlePluginComplexTextInputKeyDown:(NSEvent *)event +- (BOOL)_tryHandlePluginComplexTextInputKeyDown:(NSEvent *)event { if (!_data->_pluginComplexTextInputIdentifier || _data->_pluginComplexTextInputState == PluginComplexTextInputDisabled) return NO; // Check if the text input window has been dismissed and let the plug-in process know. // This is only valid with the updated Cocoa text input spec. - [self _wk_disableComplexTextInputIfNecessary]; + [self _disableComplexTextInputIfNecessary]; // Try feeding the keyboard event directly to the plug-in. if (_data->_pluginComplexTextInputState == PluginComplexTextInputEnabledLegacy) - return [self _wk_handlePluginComplexTextInputKeyDown:event]; + return [self _handlePluginComplexTextInputKeyDown:event]; return NO; } @@ -1337,7 +1341,7 @@ static const short kIOHIDEventTypeScroll = 6; // the current event prevents that from causing a problem inside WebKit or AppKit code. [[theEvent retain] autorelease]; - if ([self _wk_tryHandlePluginComplexTextInputKeyDown:theEvent]) { + if ([self _tryHandlePluginComplexTextInputKeyDown:theEvent]) { LOG(TextInput, "...handled by plug-in"); return; } @@ -1371,7 +1375,7 @@ static const short kIOHIDEventTypeScroll = 6; _data->_page->handleKeyboardEvent(NativeWebKeyboardEvent(theEvent, self)); } -- (void)_wk_executeSavedKeypressCommands +- (void)_executeSavedKeypressCommands { WKViewInterpretKeyEventsParameters* parameters = _data->_interpretKeyEventsParameters; if (!parameters || parameters->commands->isEmpty()) @@ -1392,7 +1396,7 @@ static const short kIOHIDEventTypeScroll = 6; LOG(TextInput, "...done executing saved keypress commands."); } -- (void)_wk_notifyInputContextAboutDiscardedComposition +- (void)_notifyInputContextAboutDiscardedComposition { // <rdar://problem/9359055>: -discardMarkedText can only be called for active contexts. // FIXME: We fail to ever notify the input context if something (e.g. a navigation) happens while the window is not key. @@ -1420,7 +1424,7 @@ static const short kIOHIDEventTypeScroll = 6; - (NSRange)selectedRange { - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; uint64_t selectionStart; uint64_t selectionLength; @@ -1444,7 +1448,7 @@ static const short kIOHIDEventTypeScroll = 6; result = _data->_page->editorState().hasComposition; if (result) { // A saved command can confirm a composition, but it cannot start a new one. - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; result = _data->_page->editorState().hasComposition; } } else { @@ -1460,7 +1464,7 @@ static const short kIOHIDEventTypeScroll = 6; - (void)unmarkText { - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; LOG(TextInput, "unmarkText"); @@ -1519,7 +1523,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (void)setMarkedText:(id)string selectedRange:(NSRange)newSelRange replacementRange:(NSRange)replacementRange { - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; BOOL isAttributedString = [string isKindOfClass:[NSAttributedString class]]; ASSERT(isAttributedString || [string isKindOfClass:[NSString class]]); @@ -1548,7 +1552,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde // In password fields, we only allow ASCII dead keys, and don't allow inline input, matching NSSecureTextInputField. // Allowing ASCII dead keys is necessary to enable full Roman input when using a Vietnamese keyboard. ASSERT(!_data->_page->editorState().hasComposition); - [self _wk_notifyInputContextAboutDiscardedComposition]; + [self _notifyInputContextAboutDiscardedComposition]; if ([text length] == 1 && [[text decomposedStringWithCanonicalMapping] characterAtIndex:0] < 0x80) { _data->_page->insertText(text, replacementRange.location, NSMaxRange(replacementRange)); } else @@ -1561,7 +1565,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (NSRange)markedRange { - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; uint64_t location; uint64_t length; @@ -1573,7 +1577,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)nsRange actualRange:(NSRangePointer)actualRange { - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; if (!_data->_page->editorState().isContentEditable) { LOG(TextInput, "attributedSubstringFromRange:(%u, %u) -> nil", nsRange.location, nsRange.length); @@ -1597,7 +1601,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (NSUInteger)characterIndexForPoint:(NSPoint)thePoint { - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; NSWindow *window = [self window]; @@ -1612,7 +1616,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde - (NSRect)firstRectForCharacterRange:(NSRange)theRange actualRange:(NSRangePointer)actualRange { - [self _wk_executeSavedKeypressCommands]; + [self _executeSavedKeypressCommands]; // Just to match NSTextView's behavior. Regression tests cannot detect this; // to reproduce, use a test application from http://bugs.webkit.org/show_bug.cgi?id=4682 @@ -1637,7 +1641,6 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde } #if ENABLE(DRAG_SUPPORT) - - (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation { NSPoint windowImageLoc = [[self window] convertScreenToBase:aPoint]; @@ -1779,7 +1782,6 @@ static void createSandboxExtensionsForFileUpload(NSPasteboard *pasteboard, Sandb return self; return nil; } - #endif // ENABLE(DRAG_SUPPORT) - (BOOL)_windowResizeMouseLocationIsInVisibleScrollerThumb:(NSPoint)loc @@ -1789,14 +1791,13 @@ static void createSandboxExtensionsForFileUpload(NSPasteboard *pasteboard, Sandb return NSMouseInRect(localPoint, visibleThumbRect, [self isFlipped]); } -- (void)_wk_updateWindowVisibility +- (void)_updateWindowVisibility { _data->_page->updateWindowIsVisible([[self window] isVisible]); } #if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 - - (BOOL)_ownsWindowGrowBox { NSWindow* window = [self window]; @@ -1845,45 +1846,54 @@ static void createSandboxExtensionsForFileUpload(NSPasteboard *pasteboard, Sandb return ownsGrowBox; } - #endif // FIXME: Use AppKit constants for these when they are available. -static NSString * const windowDidBecomeVisibleNotification = @"_NSWindowDidBecomeVisible"; -static NSString * const windowDidOrderOffScreenNotification = @"NSWindowDidOrderOffScreenNotification"; static NSString * const windowDidChangeBackingPropertiesNotification = @"NSWindowDidChangeBackingPropertiesNotification"; static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOldScaleFactorKey"; -- (void)_wk_updateWindowObserversForWindow:(NSWindow *)window +- (void)addWindowObserversForWindow:(NSWindow *)window +{ + if (window) { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidBecomeKey:) + name:NSWindowDidBecomeKeyNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidResignKey:) + name:NSWindowDidResignKeyNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidMiniaturize:) + name:NSWindowDidMiniaturizeNotification object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidDeminiaturize:) + name:NSWindowDidDeminiaturizeNotification object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidMove:) + name:NSWindowDidMoveNotification object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidResize:) + name:NSWindowDidResizeNotification object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidOrderOffScreen:) + name:@"NSWindowDidOrderOffScreenNotification" object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidOrderOnScreen:) + name:@"_NSWindowDidBecomeVisible" object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeBackingProperties:) + name:windowDidChangeBackingPropertiesNotification object:window]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeScreen:) + name:NSWindowDidChangeScreenNotification object:window]; + } +} + +- (void)removeWindowObservers { - for (id observer in _data->_observers.get()) - [[NSNotificationCenter defaultCenter] removeObserver:observer]; - [_data->_observers.get() removeAllObjects]; - + NSWindow *window = [self window]; if (!window) return; - if (!_data->_observers) - _data->_observers = adoptNS([[NSMutableArray alloc] init]); - - #define ADD_OBSERVER(selectorName, notificationName, notificationObject) \ - [_data->_observers.get() addObject:[[NSNotificationCenter defaultCenter] \ - addObserverForName:notificationName object:notificationObject queue:[NSOperationQueue mainQueue] \ - usingBlock:^(NSNotification *notification){ [self selectorName:notification]; }] \ - ]; - - ADD_OBSERVER(_wk_windowDidBecomeKey, NSWindowDidBecomeKeyNotification, nil); - ADD_OBSERVER(_wk_windowDidChangeBackingProperties, windowDidChangeBackingPropertiesNotification, window); - ADD_OBSERVER(_wk_windowDidChangeScreen, NSWindowDidChangeScreenNotification, window); - ADD_OBSERVER(_wk_windowDidDeminiaturize, NSWindowDidDeminiaturizeNotification, window); - ADD_OBSERVER(_wk_windowDidMiniaturize, NSWindowDidMiniaturizeNotification, window); - ADD_OBSERVER(_wk_windowDidMove, NSWindowDidMoveNotification, window); - ADD_OBSERVER(_wk_windowDidOrderOffScreen, windowDidOrderOffScreenNotification, window); - ADD_OBSERVER(_wk_windowDidOrderOnScreen, windowDidBecomeVisibleNotification, window); - ADD_OBSERVER(_wk_windowDidResignKey, NSWindowDidResignKeyNotification, nil); - ADD_OBSERVER(_wk_windowDidResize, NSWindowDidResizeNotification, window); - - #undef ADD_OBSERVER + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResignKeyNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidMiniaturizeNotification object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidMoveNotification object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResizeNotification object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:@"NSWindowDidOrderOffScreenNotification" object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:@"_NSWindowDidBecomeVisible" object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:windowDidChangeBackingPropertiesNotification object:window]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidChangeScreenNotification object:window]; } - (void)viewWillMoveToWindow:(NSWindow *)window @@ -1903,7 +1913,8 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl #endif _data->_pageClient->viewWillMoveToAnotherWindow(); - [self _wk_updateWindowObserversForWindow:window]; + [self removeWindowObservers]; + [self addWindowObserversForWindow:window]; #if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 if ([currentWindow _growBoxOwner] == self) @@ -1913,28 +1924,26 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl - (void)viewDidMoveToWindow { - [self removeAllToolTips]; - // We want to make sure to update the active state while hidden, so if the view is about to become visible, we // update the active state first and then make it visible. If the view is about to be hidden, we hide it first and then // update the active state. if ([self window]) { _data->_windowHasValidBackingStore = NO; - [self _wk_updateWindowVisibility]; + [self _updateWindowVisibility]; _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive); _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible | WebPageProxy::ViewIsInWindow); - [self _wk_updateWindowAndViewFrames]; + [self _updateWindowAndViewFrames]; if (!_data->_flagsChangedEventMonitor) { _data->_flagsChangedEventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSFlagsChangedMask handler:^(NSEvent *flagsChangedEvent) { - [self _wk_postFakeMouseMovedEventForFlagsChangedEvent:flagsChangedEvent]; + [self _postFakeMouseMovedEventForFlagsChangedEvent:flagsChangedEvent]; return flagsChangedEvent; }]; } - [self _wk_accessibilityRegisterUIProcessTokens]; + [self _accessibilityRegisterUIProcessTokens]; } else { - [self _wk_updateWindowVisibility]; + [self _updateWindowVisibility]; _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible); _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive | WebPageProxy::ViewIsInWindow); @@ -1952,67 +1961,67 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl #endif } - _data->_page->setIntrinsicDeviceScaleFactor([self _wk_intrinsicDeviceScaleFactor]); + _data->_page->setIntrinsicDeviceScaleFactor([self _intrinsicDeviceScaleFactor]); } -- (void)_wk_windowScreenDidChange +- (void)doWindowDidChangeScreen { _data->_page->windowScreenDidChange((PlatformDisplayID)[[[[[self window] screen] deviceDescription] objectForKey:@"NSScreenNumber"] intValue]); } -- (void)_wk_windowDidBecomeKey:(NSNotification *)notification +- (void)_windowDidBecomeKey:(NSNotification *)notification { NSWindow *keyWindow = [notification object]; if (keyWindow == [self window] || keyWindow == [[self window] attachedSheet]) { - [self _wk_updateSecureInputState]; + [self _updateSecureInputState]; _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive); } // Send a change screen to make sure the initial displayID is set - [self _wk_windowScreenDidChange]; + [self doWindowDidChangeScreen]; } -- (void)_wk_windowDidChangeScreen:(NSNotification *)notification +- (void)_windowDidChangeScreen:(NSNotification *)notification { - [self _wk_windowScreenDidChange]; + [self doWindowDidChangeScreen]; } -- (void)_wk_windowDidResignKey:(NSNotification *)notification +- (void)_windowDidResignKey:(NSNotification *)notification { NSWindow *formerKeyWindow = [notification object]; if (formerKeyWindow == [self window] || formerKeyWindow == [[self window] attachedSheet]) { - [self _wk_updateSecureInputState]; + [self _updateSecureInputState]; _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive); } } -- (void)_wk_windowDidMiniaturize:(NSNotification *)notification +- (void)_windowDidMiniaturize:(NSNotification *)notification { _data->_windowHasValidBackingStore = NO; - [self _wk_updateWindowVisibility]; + [self _updateWindowVisibility]; } -- (void)_wk_windowDidDeminiaturize:(NSNotification *)notification +- (void)_windowDidDeminiaturize:(NSNotification *)notification { - [self _wk_updateWindowVisibility]; + [self _updateWindowVisibility]; } -- (void)_wk_windowDidMove:(NSNotification *)notification +- (void)_windowDidMove:(NSNotification *)notification { - [self _wk_updateWindowAndViewFrames]; + [self _updateWindowAndViewFrames]; } -- (void)_wk_windowDidResize:(NSNotification *)notification +- (void)_windowDidResize:(NSNotification *)notification { _data->_windowHasValidBackingStore = NO; - [self _wk_updateWindowAndViewFrames]; + [self _updateWindowAndViewFrames]; } -- (void)_wk_windowDidOrderOffScreen:(NSNotification *)notification +- (void)_windowDidOrderOffScreen:(NSNotification *)notification { - [self _wk_updateWindowVisibility]; + [self _updateWindowVisibility]; // We want to make sure to update the active state while hidden, so since the view is about to be hidden, // we hide it first and then update the active state. @@ -2020,9 +2029,9 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive); } -- (void)_wk_windowDidOrderOnScreen:(NSNotification *)notification +- (void)_windowDidOrderOnScreen:(NSNotification *)notification { - [self _wk_updateWindowVisibility]; + [self _updateWindowVisibility]; // We want to make sure to update the active state while hidden, so since the view is about to become visible, // we update the active state first and then make it visible. @@ -2030,10 +2039,10 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible); } -- (void)_wk_windowDidChangeBackingProperties:(NSNotification *)notification +- (void)_windowDidChangeBackingProperties:(NSNotification *)notification { CGFloat oldBackingScaleFactor = [[notification.userInfo objectForKey:backingPropertyOldScaleFactorKey] doubleValue]; - CGFloat newBackingScaleFactor = [self _wk_intrinsicDeviceScaleFactor]; + CGFloat newBackingScaleFactor = [self _intrinsicDeviceScaleFactor]; if (oldBackingScaleFactor == newBackingScaleFactor) return; @@ -2130,7 +2139,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I drawingArea->colorSpaceDidChange(); } -- (void)_wk_accessibilityRegisterUIProcessTokens +- (void)_accessibilityRegisterUIProcessTokens { // Initialize remote accessibility when the window connection has been established. NSData *remoteElementToken = WKAXRemoteTokenForElement(self); @@ -2140,7 +2149,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_page->registerUIProcessAccessibilityTokens(elementToken, windowToken); } -- (void)_wk_updateRemoteAccessibilityRegistration:(BOOL)registerProcess +- (void)_updateRemoteAccessibilityRegistration:(BOOL)registerProcess { // When the tree is connected/disconnected, the remote accessibility registration // needs to be updated with the pid of the remote process. If the process is going @@ -2212,7 +2221,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return hitView; } -- (void)_wk_postFakeMouseMovedEventForFlagsChangedEvent:(NSEvent *)flagsChangedEvent +- (void)_postFakeMouseMovedEventForFlagsChangedEvent:(NSEvent *)flagsChangedEvent { NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved location:[[flagsChangedEvent window] convertScreenToBase:[NSEvent mouseLocation]] modifierFlags:[flagsChangedEvent modifierFlags] timestamp:[flagsChangedEvent timestamp] windowNumber:[flagsChangedEvent windowNumber] @@ -2226,7 +2235,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return (NSInteger)self; } -- (float)_wk_intrinsicDeviceScaleFactor +- (float)_intrinsicDeviceScaleFactor { NSWindow *window = [self window]; #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @@ -2240,7 +2249,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I #endif } -- (void)_wk_setDrawingAreaSize:(NSSize)size +- (void)_setDrawingAreaSize:(NSSize)size { if (!_data->_page->drawingArea()) return; @@ -2249,6 +2258,11 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_resizeScrollOffset = NSZeroSize; } +- (BOOL)_shouldUseTiledDrawingArea +{ + return NO; +} + #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 - (void)quickLookWithEvent:(NSEvent *)event { @@ -2261,17 +2275,21 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I @implementation WKView (Internal) -- (PassOwnPtr<WebKit::DrawingAreaProxy>)_wk_createDrawingAreaProxy +- (PassOwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy { #if ENABLE(THREADED_SCROLLING) - if ([self _shouldUseTiledDrawingArea]) + if ([self _shouldUseTiledDrawingArea]) { + if (getenv("WK_USE_REMOTE_LAYER_TREE_DRAWING_AREA")) + return RemoteLayerTreeDrawingAreaProxy::create(_data->_page.get()); + return TiledCoreAnimationDrawingAreaProxy::create(_data->_page.get()); + } #endif return DrawingAreaProxyImpl::create(_data->_page.get()); } -- (BOOL)_wk_isFocused +- (BOOL)_isFocused { if (_data->_inBecomeFirstResponder) return YES; @@ -2280,7 +2298,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return [[self window] firstResponder] == self; } -- (WebKit::ColorSpaceData)_wk_colorSpace +- (WebKit::ColorSpaceData)_colorSpace { if (!_data->_colorSpace) { if ([self window]) @@ -2295,32 +2313,32 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return colorSpaceData; } -- (void)_wk_processDidCrash +- (void)_processDidCrash { if (_data->_layerHostingView) - [self _wk_exitAcceleratedCompositingMode]; + [self _exitAcceleratedCompositingMode]; - [self _wk_updateRemoteAccessibilityRegistration:NO]; + [self _updateRemoteAccessibilityRegistration:NO]; } -- (void)_wk_pageClosed +- (void)_pageClosed { - [self _wk_updateRemoteAccessibilityRegistration:NO]; + [self _updateRemoteAccessibilityRegistration:NO]; } -- (void)_wk_didRelaunchProcess +- (void)_didRelaunchProcess { - [self _wk_accessibilityRegisterUIProcessTokens]; + [self _accessibilityRegisterUIProcessTokens]; } -- (void)_wk_setCursor:(NSCursor *)cursor +- (void)_setCursor:(NSCursor *)cursor { if ([NSCursor currentCursor] == cursor) return; [cursor set]; } -- (void)_wk_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState +- (void)_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState { ValidationVector items = _data->_validationMap.take(commandName); size_t size = items.size(); @@ -2333,7 +2351,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I } } -- (BOOL)_wk_tryPostProcessPluginComplexTextInputKeyDown:(NSEvent *)event +- (BOOL)_tryPostProcessPluginComplexTextInputKeyDown:(NSEvent *)event { if (!_data->_pluginComplexTextInputIdentifier || _data->_pluginComplexTextInputState == PluginComplexTextInputDisabled) return NO; @@ -2342,15 +2360,15 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I if (_data->_pluginComplexTextInputState == PluginComplexTextInputEnabledLegacy) return NO; - return [self _wk_handlePluginComplexTextInputKeyDown:event]; + return [self _handlePluginComplexTextInputKeyDown:event]; } -- (void)_wk_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled +- (void)_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled { if ([event type] != NSKeyDown) return; - if ([self _wk_tryPostProcessPluginComplexTextInputKeyDown:event]) + if ([self _tryPostProcessPluginComplexTextInputKeyDown:event]) return; if (eventWasHandled) { @@ -2369,7 +2387,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_keyDownEventBeingResent = nullptr; } -- (BOOL)_wk_interpretKeyEvent:(NSEvent *)event savingCommandsTo:(Vector<WebCore::KeypressCommand>&)commands +- (BOOL)_interpretKeyEvent:(NSEvent *)event savingCommandsTo:(Vector<WebCore::KeypressCommand>&)commands { ASSERT(!_data->_interpretKeyEventsParameters); ASSERT(commands.isEmpty()); @@ -2404,12 +2422,12 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return parameters.eventInterpretationHadSideEffects; } -- (NSRect)_wk_convertToDeviceSpace:(NSRect)rect +- (NSRect)_convertToDeviceSpace:(NSRect)rect { return toDeviceSpace(rect, [self window]); } -- (NSRect)_wk_convertToUserSpace:(NSRect)rect +- (NSRect)_convertToUserSpace:(NSRect)rect { return toUserSpace(rect, [self window]); } @@ -2425,7 +2443,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return TRACKING_RECT_TAG; } -- (NSTrackingRectTag)_wk_addTrackingRect:(NSRect)rect owner:(id)owner userData:(void *)data assumeInside:(BOOL)assumeInside useTrackingNum:(int)tag +- (NSTrackingRectTag)_addTrackingRect:(NSRect)rect owner:(id)owner userData:(void *)data assumeInside:(BOOL)assumeInside useTrackingNum:(int)tag { ASSERT(tag == 0 || tag == TRACKING_RECT_TAG); ASSERT(_data->_trackingRectOwner == nil); @@ -2434,7 +2452,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return TRACKING_RECT_TAG; } -- (void)_wk_addTrackingRects:(NSRect *)rects owner:(id)owner userDataList:(void **)userDataList assumeInsideList:(BOOL *)assumeInsideList trackingNums:(NSTrackingRectTag *)trackingNums count:(int)count +- (void)_addTrackingRects:(NSRect *)rects owner:(id)owner userDataList:(void **)userDataList assumeInsideList:(BOOL *)assumeInsideList trackingNums:(NSTrackingRectTag *)trackingNums count:(int)count { ASSERT(count == 1); ASSERT(trackingNums[0] == 0 || trackingNums[0] == TRACKING_RECT_TAG); @@ -2468,7 +2486,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I ASSERT_NOT_REACHED(); } -- (void)_wk_removeTrackingRects:(NSTrackingRectTag *)tags count:(int)count +- (void)_removeTrackingRects:(NSTrackingRectTag *)tags count:(int)count { int i; for (i = 0; i < count; ++i) { @@ -2482,7 +2500,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I } } -- (void)_wk_sendToolTipMouseExited +- (void)_sendToolTipMouseExited { // Nothing matters except window, trackingNumber, and userData. NSEvent *fakeEvent = [NSEvent enterExitEventWithType:NSMouseExited @@ -2497,7 +2515,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I [_data->_trackingRectOwner mouseExited:fakeEvent]; } -- (void)_wk_sendToolTipMouseEntered +- (void)_sendToolTipMouseEntered { // Nothing matters except window, trackingNumber, and userData. NSEvent *fakeEvent = [NSEvent enterExitEventWithType:NSMouseEntered @@ -2517,21 +2535,21 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return nsStringFromWebCoreString(_data->_page->toolTip()); } -- (void)_wk_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip +- (void)_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip { if (oldToolTip) - [self _wk_sendToolTipMouseExited]; + [self _sendToolTipMouseExited]; if (newToolTip && [newToolTip length] > 0) { // See radar 3500217 for why we remove all tooltips rather than just the single one we created. [self removeAllToolTips]; NSRect wideOpenRect = NSMakeRect(-100000, -100000, 200000, 200000); _data->_lastToolTipTag = [self addToolTipRect:wideOpenRect owner:self userData:NULL]; - [self _wk_sendToolTipMouseEntered]; + [self _sendToolTipMouseEntered]; } } -- (void)_wk_setFindIndicator:(PassRefPtr<FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate +- (void)_setFindIndicator:(PassRefPtr<FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate { if (!findIndicator) { _data->_findIndicatorWindow = nullptr; @@ -2544,7 +2562,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_findIndicatorWindow->setFindIndicator(findIndicator, fadeOut, animate); } -- (void)_wk_enterAcceleratedCompositingMode:(const LayerTreeContext&)layerTreeContext +- (void)_enterAcceleratedCompositingMode:(const LayerTreeContext&)layerTreeContext { ASSERT(!_data->_layerHostingView); ASSERT(!layerTreeContext.isEmpty()); @@ -2573,7 +2591,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I [CATransaction commit]; } -- (void)_wk_exitAcceleratedCompositingMode +- (void)_exitAcceleratedCompositingMode { ASSERT(_data->_layerHostingView); @@ -2584,7 +2602,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_layerHostingView = nullptr; } -- (void)_wk_updateAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext +- (void)_updateAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext { if (_data->_layerHostingView) { // Wrap the call to setSublayers: in a CATransaction with actions disabled to @@ -2597,18 +2615,18 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I [CATransaction commit]; } else { - [self _wk_exitAcceleratedCompositingMode]; - [self _wk_enterAcceleratedCompositingMode:layerTreeContext]; + [self _exitAcceleratedCompositingMode]; + [self _enterAcceleratedCompositingMode:layerTreeContext]; } } -- (void)_wk_setAccessibilityWebProcessToken:(NSData *)data +- (void)_setAccessibilityWebProcessToken:(NSData *)data { _data->_remoteAccessibilityChild = WKAXRemoteElementForToken(data); - [self _wk_updateRemoteAccessibilityRegistration:YES]; + [self _updateRemoteAccessibilityRegistration:YES]; } -- (void)_wk_pluginFocusOrWindowFocusChanged:(BOOL)pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier +- (void)_pluginFocusOrWindowFocusChanged:(BOOL)pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier { BOOL inputSourceChanged = _data->_pluginComplexTextInputIdentifier; @@ -2636,17 +2654,17 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I [NSApp updateWindows]; } -- (void)_wk_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier +- (void)_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier { if (pluginComplexTextInputIdentifier != _data->_pluginComplexTextInputIdentifier) { // We're asked to update the state for a plug-in that doesn't have focus. return; } - [self _wk_setPluginComplexTextInputState:pluginComplexTextInputState]; + [self _setPluginComplexTextInputState:pluginComplexTextInputState]; } -- (void)_wk_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation +- (void)_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation { bool hadPDFView = _data->_pdfViewController; _data->_pdfViewController = nullptr; @@ -2658,14 +2676,14 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_page->drawingArea()->pageCustomRepresentationChanged(); } -- (void)_wk_didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:(const String&)suggestedFilename dataReference:(const CoreIPC::DataReference&)dataReference +- (void)_didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:(const String&)suggestedFilename dataReference:(const CoreIPC::DataReference&)dataReference { ASSERT(_data->_pdfViewController); _data->_pdfViewController->setPDFDocumentData(_data->_page->mainFrame()->mimeType(), suggestedFilename, dataReference); } -- (double)_wk_customRepresentationZoomFactor +- (double)_customRepresentationZoomFactor { if (!_data->_pdfViewController) return 1; @@ -2673,7 +2691,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I return _data->_pdfViewController->zoomFactor(); } -- (void)_wk_setCustomRepresentationZoomFactor:(double)zoomFactor +- (void)_setCustomRepresentationZoomFactor:(double)zoomFactor { if (!_data->_pdfViewController) return; @@ -2681,7 +2699,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_pdfViewController->setZoomFactor(zoomFactor); } -- (void)_wk_findStringInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count +- (void)_findStringInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count { if (!_data->_pdfViewController) return; @@ -2689,7 +2707,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_pdfViewController->findString(string, options, count); } -- (void)_wk_countStringMatchesInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count +- (void)_countStringMatchesInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count { if (!_data->_pdfViewController) return; @@ -2697,7 +2715,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_pdfViewController->countStringMatches(string, options, count); } -- (void)_wk_setDragImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag +- (void)_setDragImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag { IntSize size([image size]); size.scale(1.0 / _data->_page->deviceScaleFactor()); @@ -2722,7 +2740,7 @@ static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension && hasCaseInsensitiveSuffix(filename, @".jpg")); } -- (void)_wk_setPromisedData:(WebCore::Image *)image withFileName:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl withArchive:(WebCore::SharedBuffer*) archiveBuffer forPasteboard:(NSString *)pasteboardName +- (void)_setPromisedData:(WebCore::Image *)image withFileName:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl withArchive:(WebCore::SharedBuffer*) archiveBuffer forPasteboard:(NSString *)pasteboardName { NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:pasteboardName]; @@ -2830,9 +2848,9 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) return [NSArray arrayWithObject:[path lastPathComponent]]; } -- (void)_wk_updateSecureInputState +- (void)_updateSecureInputState { - if (![[self window] isKeyWindow] || ![self _wk_isFocused]) { + if (![[self window] isKeyWindow] || ![self _isFocused]) { if (_data->_inSecureInputState) { DisableSecureEventInput(); _data->_inSecureInputState = NO; @@ -2858,13 +2876,13 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) _data->_inSecureInputState = isInPasswordField; } -- (void)_wk_updateTextInputStateIncludingSecureInputState:(BOOL)updateSecureInputState +- (void)_updateTextInputStateIncludingSecureInputState:(BOOL)updateSecureInputState { const EditorState& editorState = _data->_page->editorState(); if (updateSecureInputState) { // This is a temporary state when editing. Flipping secure input state too quickly can expose race conditions. if (!editorState.selectionIsNone) - [self _wk_updateSecureInputState]; + [self _updateSecureInputState]; } if (!editorState.hasComposition || editorState.shouldIgnoreCompositionSelectionChange) @@ -2872,12 +2890,12 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) _data->_page->cancelComposition(); - [self _wk_notifyInputContextAboutDiscardedComposition]; + [self _notifyInputContextAboutDiscardedComposition]; } -- (void)_wk_resetTextInputState +- (void)_resetTextInputState { - [self _wk_notifyInputContextAboutDiscardedComposition]; + [self _notifyInputContextAboutDiscardedComposition]; if (_data->_inSecureInputState) { DisableSecureEventInput(); @@ -2885,7 +2903,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) } } -- (void)_wk_didChangeScrollbarsForMainFrame +- (void)_didChangeScrollbarsForMainFrame { #if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 [self _updateGrowBoxForWindowFrameChange]; @@ -2893,13 +2911,12 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) } #if ENABLE(FULLSCREEN_API) - -- (BOOL)_wk_hasFullScreenWindowController +- (BOOL)hasFullScreenWindowController { return (bool)_data->_fullScreenWindowController; } -- (WKFullScreenWindowController*)_wk_fullScreenWindowController +- (WKFullScreenWindowController*)fullScreenWindowController { if (!_data->_fullScreenWindowController) { _data->_fullScreenWindowController.adoptNS([[WKFullScreenWindowController alloc] init]); @@ -2908,17 +2925,16 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) return _data->_fullScreenWindowController.get(); } -- (void)_wk_closeFullScreenWindowController +- (void)closeFullScreenWindowController { if (!_data->_fullScreenWindowController) return; [_data->_fullScreenWindowController.get() close]; _data->_fullScreenWindowController = nullptr; } - #endif -- (bool)_wk_executeSavedCommandBySelector:(SEL)selector +- (bool)_executeSavedCommandBySelector:(SEL)selector { // The sink does two things: 1) Tells us if the responder went unhandled, and // 2) prevents any NSBeep; we don't ever want to beep here. @@ -2928,7 +2944,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) return ![sink.get() didReceiveUnhandledCommand]; } -- (void)_wk_cacheWindowBottomCornerRect +- (void)_cacheWindowBottomCornerRect { #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // FIXME: We should remove this code when <rdar://problem/9362085> is resolved. @@ -2942,7 +2958,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) #endif } -- (NSInteger)_wk_spellCheckerDocumentTag +- (NSInteger)spellCheckerDocumentTag { if (!_data->_hasSpellCheckerDocumentTag) { _data->_spellCheckerDocumentTag = [NSSpellChecker uniqueSpellDocumentTag]; @@ -2951,17 +2967,17 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) return _data->_spellCheckerDocumentTag; } -- (void)_wk_handleAcceptedAlternativeText:(NSString*)text +- (void)handleAcceptedAlternativeText:(NSString*)text { _data->_page->handleAlternativeTextUIResult(text); } -- (void)_wk_setSuppressVisibilityUpdates:(BOOL)suppressVisibilityUpdates +- (void)_setSuppressVisibilityUpdates:(BOOL)suppressVisibilityUpdates { _data->_page->setSuppressVisibilityUpdates(suppressVisibilityUpdates); } -- (BOOL)_wk_suppressVisibilityUpdates +- (BOOL)_suppressVisibilityUpdates { return _data->_page->suppressVisibilityUpdates(); } @@ -2970,7 +2986,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) @implementation WKView (Private) -- (void)_wk_registerDraggedTypes +- (void)_registerDraggedTypes { NSMutableSet *types = [[NSMutableSet alloc] initWithArray:PasteboardTypes::forEditing()]; [types addObjectsFromArray:PasteboardTypes::forURL()]; @@ -3016,7 +3032,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) _data->_pageClient = PageClientImpl::create(self); _data->_page = toImpl(contextRef)->createWebPage(_data->_pageClient.get(), toImpl(pageGroupRef), toImpl(relatedPage)); - _data->_page->setIntrinsicDeviceScaleFactor([self _wk_intrinsicDeviceScaleFactor]); + _data->_page->setIntrinsicDeviceScaleFactor([self _intrinsicDeviceScaleFactor]); _data->_page->initializeWebPage(); #if ENABLE(FULLSCREEN_API) _data->_page->fullScreenManager()->setWebView(self); @@ -3024,7 +3040,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) _data->_mouseDownEvent = nil; _data->_ignoringMouseDraggedEvents = NO; - [self _wk_registerDraggedTypes]; + [self _registerDraggedTypes]; if ([self _shouldUseTiledDrawingArea]) { self.wantsLayer = YES; @@ -3039,7 +3055,6 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) } #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 - - (BOOL)wantsUpdateLayer { return [self _shouldUseTiledDrawingArea]; @@ -3052,7 +3067,6 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) if (DrawingAreaProxy* drawingArea = _data->_page->drawingArea()) drawingArea->waitForPossibleGeometryUpdate(); } - #endif - (WKPageRef)pageRef @@ -3107,7 +3121,7 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) return; if (!(--_data->_frameSizeUpdatesDisabledCount)) - [self _wk_setDrawingAreaSize:[self frame].size]; + [self _setDrawingAreaSize:[self frame].size]; } - (BOOL)frameSizeUpdatesDisabled @@ -3131,11 +3145,6 @@ static NSString *pathWithUniqueFilenameForPath(NSString *path) #endif } -- (BOOL)_shouldUseTiledDrawingArea -{ - return NO; -} - @end @implementation WKResponderChainSink diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h index f2b681649..2e99e7976 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h +++ b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -50,59 +50,58 @@ namespace WebKit { @class WKFullScreenWindowController; @interface WKView (Internal) - -- (PassOwnPtr<WebKit::DrawingAreaProxy>)_wk_createDrawingAreaProxy; -- (BOOL)_wk_isFocused; -- (void)_wk_processDidCrash; -- (void)_wk_pageClosed; -- (void)_wk_didRelaunchProcess; -- (void)_wk_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip; -- (void)_wk_setCursor:(NSCursor *)cursor; -- (void)_wk_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState; -- (BOOL)_wk_interpretKeyEvent:(NSEvent *)theEvent savingCommandsTo:(Vector<WebCore::KeypressCommand>&)commands; -- (void)_wk_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled; -- (bool)_wk_executeSavedCommandBySelector:(SEL)selector; -- (NSRect)_wk_convertToDeviceSpace:(NSRect)rect; -- (NSRect)_wk_convertToUserSpace:(NSRect)rect; -- (void)_wk_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate; - -- (void)_wk_enterAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext; -- (void)_wk_exitAcceleratedCompositingMode; -- (void)_wk_updateAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext; - -- (void)_wk_setAccessibilityWebProcessToken:(NSData *)data; - -- (void)_wk_pluginFocusOrWindowFocusChanged:(BOOL)pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier; -- (void)_wk_setPluginComplexTextInputState:(WebKit::PluginComplexTextInputState)pluginComplexTextInputState pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier; - -- (void)_wk_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation; -- (void)_wk_didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:(const String&)suggestedFilename dataReference:(const CoreIPC::DataReference&)dataReference; -- (double)_wk_customRepresentationZoomFactor; -- (void)_wk_setCustomRepresentationZoomFactor:(double)zoomFactor; -- (void)_wk_findStringInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count; -- (void)_wk_countStringMatchesInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count; -- (void)_wk_setDragImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag; -- (void)_wk_setPromisedData:(WebCore::Image *)image withFileName:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl withArchive:(WebCore::SharedBuffer*) archiveBuffer forPasteboard:(NSString *)pasteboardName; -- (void)_wk_updateSecureInputState; -- (void)_wk_updateTextInputStateIncludingSecureInputState:(BOOL)updateSecureInputState; -- (void)_wk_resetTextInputState; - -- (void)_wk_didChangeScrollbarsForMainFrame; - -- (WebKit::ColorSpaceData)_wk_colorSpace; +- (PassOwnPtr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy; +- (BOOL)_isFocused; +- (void)_processDidCrash; +- (void)_pageClosed; +- (void)_didRelaunchProcess; +- (void)_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip; +- (void)_setCursor:(NSCursor *)cursor; +- (void)_setUserInterfaceItemState:(NSString *)commandName enabled:(BOOL)isEnabled state:(int)newState; +- (BOOL)_interpretKeyEvent:(NSEvent *)theEvent savingCommandsTo:(Vector<WebCore::KeypressCommand>&)commands; +- (void)_doneWithKeyEvent:(NSEvent *)event eventWasHandled:(BOOL)eventWasHandled; +- (bool)_executeSavedCommandBySelector:(SEL)selector; +- (NSRect)_convertToDeviceSpace:(NSRect)rect; +- (NSRect)_convertToUserSpace:(NSRect)rect; +- (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate; + +- (void)_enterAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext; +- (void)_exitAcceleratedCompositingMode; +- (void)_updateAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext; + +- (void)_setAccessibilityWebProcessToken:(NSData *)data; + +- (void)_pluginFocusOrWindowFocusChanged:(BOOL)pluginHasFocusAndWindowHasFocus pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier; +- (void)_setPluginComplexTextInputState:(WebKit::PluginComplexTextInputState)pluginComplexTextInputState pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier; + +- (void)_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation; +- (void)_didFinishLoadingDataForCustomRepresentationWithSuggestedFilename:(const String&)suggestedFilename dataReference:(const CoreIPC::DataReference&)dataReference; +- (double)_customRepresentationZoomFactor; +- (void)_setCustomRepresentationZoomFactor:(double)zoomFactor; +- (void)_findStringInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count; +- (void)_countStringMatchesInCustomRepresentation:(NSString *)string withFindOptions:(WebKit::FindOptions)options maxMatchCount:(NSUInteger)count; +- (void)_setDragImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag; +- (void)_setPromisedData:(WebCore::Image *)image withFileName:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl withArchive:(WebCore::SharedBuffer*) archiveBuffer forPasteboard:(NSString *)pasteboardName; +- (void)_updateSecureInputState; +- (void)_updateTextInputStateIncludingSecureInputState:(BOOL)updateSecureInputState; +- (void)_resetTextInputState; + +- (void)_didChangeScrollbarsForMainFrame; + +- (WebKit::ColorSpaceData)_colorSpace; #if ENABLE(FULLSCREEN_API) -- (BOOL)_wk_hasFullScreenWindowController; -- (WKFullScreenWindowController*)_wk_fullScreenWindowController; -- (void)_wk_closeFullScreenWindowController; +- (BOOL)hasFullScreenWindowController; +- (WKFullScreenWindowController*)fullScreenWindowController; +- (void)closeFullScreenWindowController; #endif -- (void)_wk_cacheWindowBottomCornerRect; +- (void)_cacheWindowBottomCornerRect; -- (NSInteger)_wk_spellCheckerDocumentTag; -- (void)_wk_handleAcceptedAlternativeText:(NSString*)text; +- (NSInteger)spellCheckerDocumentTag; +- (void)handleAcceptedAlternativeText:(NSString*)text; -- (void)_wk_setSuppressVisibilityUpdates:(BOOL)suppressVisibilityUpdates; -- (BOOL)_wk_suppressVisibilityUpdates; +- (void)_setSuppressVisibilityUpdates:(BOOL)suppressVisibilityUpdates; +- (BOOL)_suppressVisibilityUpdates; @end diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h index 035b1ea2c..51578764f 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h +++ b/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -50,8 +50,4 @@ - (void)performDictionaryLookupAtCurrentMouseLocation; + (void)hideWordDefinitionWindow; -// FIXME: This method currently overridden by Safari to turn tiled drawing area on. -// We should come up with a cleaner SPI or API for this. -- (BOOL)_shouldUseTiledDrawingArea; - @end |