Changeset 163042 in webkit


Ignore:
Timestamp:
Jan 29, 2014 2:46:59 PM (10 years ago)
Author:
andersca@apple.com
Message:

Make WKWebView limp along on OS X
https://bugs.webkit.org/show_bug.cgi?id=127857

Reviewed by Tim Horton.

On Mac, create a WKView and add it as a subview of the WKWebVew so we'll actually get something
on screen when creating a WKWebView.

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView initWithFrame:configuration:]):
Create a WKView.

(-[WKWebView resizeSubviewsWithOldSize:]):
Resize the WKView.

  • UIProcess/API/mac/WKView.mm:

(-[WKView initWithFrame:configuration:]):
Add new initializer.

  • UIProcess/API/mac/WKViewInternal.h:

Use a class extension for internal methods and add the new initializer.

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r163038 r163042  
     12014-01-29  Anders Carlsson  <andersca@apple.com>
     2
     3        Make WKWebView limp along on OS X
     4        https://bugs.webkit.org/show_bug.cgi?id=127857
     5
     6        Reviewed by Tim Horton.
     7
     8        On Mac, create a WKView and add it as a subview of the WKWebVew so we'll actually get something
     9        on screen when creating a WKWebView.
     10
     11        * UIProcess/API/Cocoa/WKWebView.mm:
     12        (-[WKWebView initWithFrame:configuration:]):
     13        Create a WKView.
     14
     15        (-[WKWebView resizeSubviewsWithOldSize:]):
     16        Resize the WKView.
     17
     18        * UIProcess/API/mac/WKView.mm:
     19        (-[WKView initWithFrame:configuration:]):
     20        Add new initializer.
     21
     22        * UIProcess/API/mac/WKViewInternal.h:
     23        Use a class extension for internal methods and add the new initializer.
     24
    1252014-01-29  Brady Eidson  <beidson@apple.com>
    226
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r163037 r163042  
    4949#endif
    5050
     51#if PLATFORM(MAC) && !PLATFORM(IOS)
     52#import "WKViewInternal.h"
     53#endif
     54
    5155@implementation WKWebView {
    5256    RetainPtr<WKWebViewConfiguration> _configuration;
     
    6165    BOOL _hasStaticMinimumLayoutSize;
    6266#endif
     67#if PLATFORM(MAC) && !PLATFORM(IOS)
     68    RetainPtr<WKView> _wkView;
     69#endif
    6370}
    6471
     
    7885        [_configuration setProcessClass:adoptNS([[WKProcessClass alloc] init]).get()];
    7986
     87    CGRect bounds = self.bounds;
     88
    8089#if PLATFORM(IOS)
    81     CGRect bounds = self.bounds;
    82 
    8390    _scrollView = adoptNS([[WKScrollView alloc] initWithFrame:bounds]);
    8491    [_scrollView setInternalDelegate:self];
     
    98105
    99106    [self _frameOrBoundsChanged];
     107#endif
     108
     109#if PLATFORM(MAC) && !PLATFORM(IOS)
     110    _wkView = [[WKView alloc] initWithFrame:bounds configuration:_configuration.get()];
     111    [self addSubview:_wkView.get()];
     112    _page = WebKit::toImpl([_wkView pageRef]);
    100113#endif
    101114
     
    266279}
    267280
    268 #pragma mark Internal
    269 
    270281- (void)_frameOrBoundsChanged
    271282{
     
    294305#endif
    295306
     307#pragma mark OS X-specific methods
     308
     309#if PLATFORM(MAC) && !PLATFORM(IOS)
     310
     311- (void)resizeSubviewsWithOldSize:(NSSize)oldSize
     312{
     313    [_wkView setFrame:self.bounds];
     314}
     315
     316#endif
     317
    296318@end
    297319
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r163003 r163042  
    5555#import "WKFullScreenWindowController.h"
    5656#import "WKPrintingView.h"
     57#import "WKProcessClassInternal.h"
    5758#import "WKStringCF.h"
    5859#import "WKTextInputWindowController.h"
    5960#import "WKViewInternal.h"
    6061#import "WKViewPrivate.h"
     62#import "WKWebViewConfiguration.h"
    6163#import "WebBackForwardList.h"
    6264#import "WebContext.h"
     
    147149};
    148150
    149 @interface WKView ()
    150 - (void)_accessibilityRegisterUIProcessTokens;
    151 - (void)_disableComplexTextInputIfNecessary;
    152 - (float)_intrinsicDeviceScaleFactor;
    153 - (void)_postFakeMouseMovedEventForFlagsChangedEvent:(NSEvent *)flagsChangedEvent;
    154 - (void)_setDrawingAreaSize:(NSSize)size;
    155 - (void)_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState;
    156 @end
    157 
    158151@interface WKViewData : NSObject {
    159152@public
     
    265258
    266259#if WK_API_ENABLED
     260
     261- (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration
     262{
     263    return [self initWithFrame:frame contextRef:toAPI(configuration.processClass->_context.get()) pageGroupRef:nullptr];
     264}
    267265
    268266- (id)initWithFrame:(NSRect)frame processGroup:(WKProcessGroup *)processGroup browsingContextGroup:(WKBrowsingContextGroup *)browsingContextGroup
     
    21902188#endif
    21912189
    2192 @end
    2193 
    2194 @implementation WKView (Internal)
    2195 
    21962190- (std::unique_ptr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy
    21972191{
  • trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h

    r162984 r163042  
    3131#import <wtf/Vector.h>
    3232
     33@class WKWebViewConfiguration;
     34
    3335namespace IPC {
    3436    class DataReference;
     
    5153@class WKFullScreenWindowController;
    5254
    53 @interface WKView (Internal)
     55@interface WKView ()
     56#if WK_API_ENABLED
     57- (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration;
     58#endif
     59
    5460- (std::unique_ptr<WebKit::DrawingAreaProxy>)_createDrawingAreaProxy;
    5561- (BOOL)_isFocused;
Note: See TracChangeset for help on using the changeset viewer.