Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Cocoa] Remove knowledge of the WKView from the WebFullScreenManagerP…
…roxy by adding a proper client

https://bugs.webkit.org/show_bug.cgi?id=125427

Reviewed by Dan Bernstein.

* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::fullScreenManagerProxyClient):
(WebKit::PageClientImpl::closeFullScreenManager):
(WebKit::PageClientImpl::isFullScreen):
(WebKit::PageClientImpl::enterFullScreen):
(WebKit::PageClientImpl::exitFullScreen):
(WebKit::PageClientImpl::beganEnterFullScreen):
(WebKit::PageClientImpl::beganExitFullScreen):
Implement the new client.

* UIProcess/API/mac/WKView.mm:
Remove call to setWebView() and do some cleanup.

* UIProcess/API/mac/WKViewInternal.h:
Convert to property syntax and re-arrange.

* UIProcess/PageClient.h:
Expose access to the new client.

* UIProcess/WebFullScreenManagerProxy.cpp:
(WebKit::WebFullScreenManagerProxy::create):
(WebKit::WebFullScreenManagerProxy::WebFullScreenManagerProxy):
(WebKit::WebFullScreenManagerProxy::invalidate):
(WebKit::WebFullScreenManagerProxy::close):
(WebKit::WebFullScreenManagerProxy::isFullScreen):
(WebKit::WebFullScreenManagerProxy::enterFullScreen):
(WebKit::WebFullScreenManagerProxy::exitFullScreen):
(WebKit::WebFullScreenManagerProxy::beganEnterFullScreen):
(WebKit::WebFullScreenManagerProxy::beganExitFullScreen):
* UIProcess/WebFullScreenManagerProxy.h:
Use the new client.

* UIProcess/WebPageProxy.cpp:
Pass the new client.

* UIProcess/mac/WebFullScreenManagerProxyMac.mm:
Removed. Now goes through the client.

* WebKit2.xcodeproj/project.pbxproj:
Remove WebFullScreenManagerProxyMac.mm.


Canonical link: https://commits.webkit.org/143511@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@160296 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
weinig committed Dec 9, 2013
1 parent 947af4d commit 4a41d7c
Show file tree
Hide file tree
Showing 12 changed files with 247 additions and 183 deletions.
49 changes: 49 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,52 @@
2013-12-08 Sam Weinig <sam@webkit.org>

[Cocoa] Remove knowledge of the WKView from the WebFullScreenManagerProxy by adding a proper client
https://bugs.webkit.org/show_bug.cgi?id=125427

Reviewed by Dan Bernstein.

* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::fullScreenManagerProxyClient):
(WebKit::PageClientImpl::closeFullScreenManager):
(WebKit::PageClientImpl::isFullScreen):
(WebKit::PageClientImpl::enterFullScreen):
(WebKit::PageClientImpl::exitFullScreen):
(WebKit::PageClientImpl::beganEnterFullScreen):
(WebKit::PageClientImpl::beganExitFullScreen):
Implement the new client.

* UIProcess/API/mac/WKView.mm:
Remove call to setWebView() and do some cleanup.

* UIProcess/API/mac/WKViewInternal.h:
Convert to property syntax and re-arrange.

* UIProcess/PageClient.h:
Expose access to the new client.

* UIProcess/WebFullScreenManagerProxy.cpp:
(WebKit::WebFullScreenManagerProxy::create):
(WebKit::WebFullScreenManagerProxy::WebFullScreenManagerProxy):
(WebKit::WebFullScreenManagerProxy::invalidate):
(WebKit::WebFullScreenManagerProxy::close):
(WebKit::WebFullScreenManagerProxy::isFullScreen):
(WebKit::WebFullScreenManagerProxy::enterFullScreen):
(WebKit::WebFullScreenManagerProxy::exitFullScreen):
(WebKit::WebFullScreenManagerProxy::beganEnterFullScreen):
(WebKit::WebFullScreenManagerProxy::beganExitFullScreen):
* UIProcess/WebFullScreenManagerProxy.h:
Use the new client.

* UIProcess/WebPageProxy.cpp:
Pass the new client.

* UIProcess/mac/WebFullScreenManagerProxyMac.mm:
Removed. Now goes through the client.

* WebKit2.xcodeproj/project.pbxproj:
Remove WebFullScreenManagerProxyMac.mm.

2013-12-07 Sam Weinig <sam@webkit.org>

[Cocoa] Remove webProcessPlugInInitialize: from the WKWebProcessPlugIn protocol
Expand Down
25 changes: 23 additions & 2 deletions Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
Expand Up @@ -28,6 +28,7 @@

#include "CorrectionPanel.h"
#include "PageClient.h"
#include "WebFullScreenManagerProxy.h"
#include <wtf/RetainPtr.h>

@class WKEditorUndoTargetObjC;
Expand All @@ -40,14 +41,19 @@ class AlternativeTextUIController;
namespace WebKit {
class FindIndicatorWindow;

class PageClientImpl FINAL : public PageClient {
class PageClientImpl FINAL : public PageClient
#if ENABLE(FULLSCREEN_API)
, public WebFullScreenManagerProxyClient
#endif
{
public:
explicit PageClientImpl(WKView*);
explicit PageClientImpl(WKView *);
virtual ~PageClientImpl();

void viewWillMoveToAnotherWindow();

private:
// PageClient
virtual std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy();
virtual void setViewNeedsDisplay(const WebCore::IntRect&);
virtual void displayView();
Expand Down Expand Up @@ -134,6 +140,21 @@ class PageClientImpl FINAL : public PageClient {
virtual Vector<String> dictationAlternatives(uint64_t dictationContext);
#endif

// Auxiliary Client Creation
#if ENABLE(FULLSCREEN_API)
WebFullScreenManagerProxyClient& fullScreenManagerProxyClient() OVERRIDE;
#endif

#if ENABLE(FULLSCREEN_API)
// WebFullScreenManagerProxyClient
virtual void closeFullScreenManager() OVERRIDE;
virtual bool isFullScreen() OVERRIDE;
virtual void enterFullScreen() OVERRIDE;
virtual void exitFullScreen() OVERRIDE;
virtual void beganEnterFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) OVERRIDE;
virtual void beganExitFullScreen(const WebCore::IntRect& initialFrame, const WebCore::IntRect& finalFrame) OVERRIDE;
#endif

WKView* m_wkView;
RetainPtr<WKEditorUndoTargetObjC> m_undoTarget;
#if USE(AUTOCORRECTION_PANEL)
Expand Down
57 changes: 51 additions & 6 deletions Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
Expand Up @@ -26,20 +26,17 @@
#import "config.h"
#import "PageClientImpl.h"

#if USE(DICTATION_ALTERNATIVES)
#import <AppKit/NSTextAlternatives.h>
#endif
#import "AttributedString.h"
#import "ColorSpaceData.h"
#import "DataReference.h"
#import "DictionaryPopupInfo.h"
#import "FindIndicator.h"
#import "NativeWebKeyboardEvent.h"
#import "StringUtilities.h"
#import "WKAPICast.h"
#import "WKFullScreenWindowController.h"
#import "WKStringCF.h"
#import "WKViewInternal.h"
#import "WKViewPrivate.h"
#import "StringUtilities.h"
#import "WebColorPickerMac.h"
#import "WebContextMenuProxyMac.h"
#import "WebEditCommandProxy.h"
Expand All @@ -53,9 +50,13 @@
#import <WebCore/KeyboardEvent.h>
#import <WebCore/NotImplemented.h>
#import <WebCore/SharedBuffer.h>
#import <WebKitSystemInterface.h>
#import <wtf/text/CString.h>
#import <wtf/text/WTFString.h>
#import <WebKitSystemInterface.h>

#if USE(DICTATION_ALTERNATIVES)
#import <AppKit/NSTextAlternatives.h>
#endif

@interface NSApplication (WebNSApplicationDetails)
- (NSCursor *)_cursorRectCursor;
Expand Down Expand Up @@ -554,4 +555,48 @@ - (void)redoEditing:(id)sender
}
#endif

#if ENABLE(FULLSCREEN_API)

WebFullScreenManagerProxyClient& PageClientImpl::fullScreenManagerProxyClient()
{
return *this;
}

// WebFullScreenManagerProxyClient

void PageClientImpl::closeFullScreenManager()
{
[m_wkView _closeFullScreenWindowController];
}

bool PageClientImpl::isFullScreen()
{
if (!m_wkView._hasFullScreenWindowController)
return false;

return m_wkView._fullScreenWindowController.isFullScreen;
}

void PageClientImpl::enterFullScreen()
{
[m_wkView._fullScreenWindowController enterFullScreen:nil];
}

void PageClientImpl::exitFullScreen()
{
[m_wkView._fullScreenWindowController exitFullScreen];
}

void PageClientImpl::beganEnterFullScreen(const IntRect& initialFrame, const IntRect& finalFrame)
{
[m_wkView._fullScreenWindowController beganEnterFullScreenWithInitialFrame:initialFrame finalFrame:finalFrame];
}

void PageClientImpl::beganExitFullScreen(const IntRect& initialFrame, const IntRect& finalFrame)
{
[m_wkView._fullScreenWindowController beganExitFullScreenWithInitialFrame:initialFrame finalFrame:finalFrame];
}

#endif // ENABLE(FULLSCREEN_API)

} // namespace WebKit
48 changes: 23 additions & 25 deletions Source/WebKit2/UIProcess/API/mac/WKView.mm
Expand Up @@ -58,7 +58,6 @@
#import "WKViewPrivate.h"
#import "WebContext.h"
#import "WebEventFactory.h"
#import "WebFullScreenManagerProxy.h"
#import "WebKit2Initialize.h"
#import "WebPage.h"
#import "WebPageGroup.h"
Expand All @@ -75,17 +74,17 @@
#import <WebCore/FloatRect.h>
#import <WebCore/Image.h>
#import <WebCore/IntRect.h>
#import <WebCore/FileSystem.h>
#import <WebCore/KeyboardEvent.h>
#import <WebCore/LocalizedStrings.h>
#import <WebCore/PlatformEventFactoryMac.h>
#import <WebCore/PlatformScreen.h>
#import <WebCore/Region.h>
#import <WebCore/SharedBuffer.h>
#import <WebCore/TextAlternativeWithRange.h>
#import <WebCore/WebCoreNSStringExtras.h>
#import <WebCore/WebCoreFullScreenPlaceholderView.h>
#import <WebCore/WebCoreFullScreenWindow.h>
#import <WebCore/FileSystem.h>
#import <WebCore/WebCoreNSStringExtras.h>
#import <WebKitSystemInterface.h>
#import <sys/stat.h>
#import <wtf/RefPtr.h>
Expand Down Expand Up @@ -2782,24 +2781,25 @@ - (void)_notifyInputContextAboutDiscardedComposition
}

#if ENABLE(FULLSCREEN_API)
- (BOOL)hasFullScreenWindowController
- (BOOL)_hasFullScreenWindowController
{
return (bool)_data->_fullScreenWindowController;
}

- (WKFullScreenWindowController*)fullScreenWindowController
- (WKFullScreenWindowController *)_fullScreenWindowController
{
if (!_data->_fullScreenWindowController)
_data->_fullScreenWindowController = adoptNS([[WKFullScreenWindowController alloc] initWithWindow:[self createFullScreenWindow] webView:self]);

return _data->_fullScreenWindowController.get();
}

- (void)closeFullScreenWindowController
- (void)_closeFullScreenWindowController
{
if (!_data->_fullScreenWindowController)
return;
[_data->_fullScreenWindowController.get() close];

[_data->_fullScreenWindowController close];
_data->_fullScreenWindowController = nullptr;
}
#endif
Expand Down Expand Up @@ -2911,9 +2911,7 @@ - (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupR
_data->_page = toImpl(contextRef)->createWebPage(*_data->_pageClient, toImpl(pageGroupRef), toImpl(relatedPage));
_data->_page->setIntrinsicDeviceScaleFactor([self _intrinsicDeviceScaleFactor]);
_data->_page->initializeWebPage();
#if ENABLE(FULLSCREEN_API)
_data->_page->fullScreenManager()->setWebView(self);
#endif

_data->_mouseDownEvent = nil;
_data->_ignoringMouseDraggedEvents = NO;
_data->_clipsToVisibleRect = NO;
Expand Down Expand Up @@ -3122,7 +3120,7 @@ - (void)setUnderlayColor:(NSColor *)underlayColor
_data->_page->setUnderlayColor(colorFromNSColor(underlayColor));
}

- (NSView*)fullScreenPlaceholderView
- (NSView *)fullScreenPlaceholderView
{
#if ENABLE(FULLSCREEN_API)
if (_data->_fullScreenWindowController && [_data->_fullScreenWindowController isFullScreen])
Expand All @@ -3131,6 +3129,20 @@ - (NSView*)fullScreenPlaceholderView
return nil;
}

- (NSWindow *)createFullScreenWindow
{
#if ENABLE(FULLSCREEN_API)
#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1080
NSRect contentRect = NSZeroRect;
#else
NSRect contentRect = [[NSScreen mainScreen] frame];
#endif
return [[[WebCoreFullScreenWindow alloc] initWithContentRect:contentRect styleMask:(NSBorderlessWindowMask | NSResizableWindowMask) backing:NSBackingStoreBuffered defer:NO] autorelease];
#else
return nil;
#endif
}

- (void)beginDeferringViewInWindowChanges
{
if (_data->_shouldDeferViewInWindowChanges) {
Expand Down Expand Up @@ -3230,20 +3242,6 @@ - (void)waitForAsyncDrawingAreaSizeUpdate
}
}

- (NSWindow*)createFullScreenWindow
{
#if ENABLE(FULLSCREEN_API)
#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1080
NSRect contentRect = NSZeroRect;
#else
NSRect contentRect = [[NSScreen mainScreen] frame];
#endif
return [[[WebCoreFullScreenWindow alloc] initWithContentRect:contentRect styleMask:(NSBorderlessWindowMask | NSResizableWindowMask) backing:NSBackingStoreBuffered defer:NO] autorelease];
#else
return nil;
#endif
}

- (BOOL)isUsingUISideCompositing
{
if (DrawingAreaProxy* drawingArea = _data->_page->drawingArea())
Expand Down
14 changes: 7 additions & 7 deletions Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
Expand Up @@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/

#import "WKView.h"
#import "WKViewPrivate.h"

#import "PluginComplexTextInputState.h"
#import "WebFindOptions.h"
Expand Down Expand Up @@ -83,12 +83,6 @@ namespace WebKit {

- (WebKit::ColorSpaceData)_colorSpace;

#if ENABLE(FULLSCREEN_API)
- (BOOL)hasFullScreenWindowController;
- (WKFullScreenWindowController*)fullScreenWindowController;
- (void)closeFullScreenWindowController;
#endif

- (void)_cacheWindowBottomCornerRect;

- (NSInteger)spellCheckerDocumentTag;
Expand All @@ -97,4 +91,10 @@ namespace WebKit {
- (void)_setSuppressVisibilityUpdates:(BOOL)suppressVisibilityUpdates;
- (BOOL)_suppressVisibilityUpdates;

// FullScreen

@property (readonly) BOOL _hasFullScreenWindowController;
@property (readonly) WKFullScreenWindowController *_fullScreenWindowController;
- (void)_closeFullScreenWindowController;

@end
21 changes: 14 additions & 7 deletions Source/WebKit2/UIProcess/PageClient.h
Expand Up @@ -43,10 +43,6 @@ OBJC_CLASS CALayer;
OBJC_CLASS WKView;
OBJC_CLASS NSTextAlternatives;
#endif

#if PLATFORM(IOS)
OBJC_CLASS UIWKView;
#endif
#endif

namespace WebCore {
Expand All @@ -59,16 +55,22 @@ namespace WebKit {
class DrawingAreaProxy;
class FindIndicator;
class NativeWebKeyboardEvent;
#if ENABLE(TOUCH_EVENTS)
class NativeWebTouchEvent;
#endif
class WebContextMenuProxy;
class WebEditCommandProxy;
class WebPopupMenuProxy;

#if ENABLE(TOUCH_EVENTS)
class NativeWebTouchEvent;
#endif

#if ENABLE(INPUT_TYPE_COLOR)
class WebColorPicker;
#endif

#if ENABLE(FULLSCREEN_API)
class WebFullScreenManagerProxyClient;
#endif

#if PLATFORM(MAC)
struct ColorSpaceData;
#endif
Expand Down Expand Up @@ -242,6 +244,11 @@ class PageClient {
virtual void selectionDidChange() = 0;
virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&, bool isCharEvent) = 0;
#endif

// Auxiliary Client Creation
#if ENABLE(FULLSCREEN_API)
virtual WebFullScreenManagerProxyClient& fullScreenManagerProxyClient() = 0;
#endif
};

} // namespace WebKit
Expand Down

0 comments on commit 4a41d7c

Please sign in to comment.