Changeset 160692 in webkit


Ignore:
Timestamp:
Dec 16, 2013 7:48:05 PM (10 years ago)
Author:
weinig@apple.com
Message:

[Cocoa] Remove unused contentAnchor SPI from WKView
https://bugs.webkit.org/show_bug.cgi?id=125826

Reviewed by Tim Horton.

  • UIProcess/API/Cocoa/WKViewPrivate.h:
  • UIProcess/API/mac/WKView.mm:

(-[WKView setFrameSize:]):
(-[WKView _setDrawingAreaSize:]):
(-[WKView _setAcceleratedCompositingModeRootLayer:]):
(-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r160686 r160692  
     12013-12-16  Sam Weinig  <sam@webkit.org>
     2
     3        [Cocoa] Remove unused contentAnchor SPI from WKView
     4        https://bugs.webkit.org/show_bug.cgi?id=125826
     5
     6        Reviewed by Tim Horton.
     7
     8        * UIProcess/API/Cocoa/WKViewPrivate.h:
     9        * UIProcess/API/mac/WKView.mm:
     10        (-[WKView setFrameSize:]):
     11        (-[WKView _setDrawingAreaSize:]):
     12        (-[WKView _setAcceleratedCompositingModeRootLayer:]):
     13        (-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
     14
    1152013-12-16  Tim Horton  <timothy_horton@apple.com>
    216
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h

    r160520 r160692  
    2727#import <WebKit2/WKView.h>
    2828
    29 #if !TARGET_OS_IPHONE
    30 
    31 typedef enum {
    32     WKContentAnchorTopLeft,
    33     WKContentAnchorTopRight,
    34     WKContentAnchorBottomLeft,
    35     WKContentAnchorBottomRight,
    36 } WKContentAnchor;
    37 
    38 #endif
    39 
    4029@interface WKView (Private)
    4130
     
    5342
    5443#if !TARGET_OS_IPHONE
    55 
    56 @property WKContentAnchor contentAnchor;
    5744
    5845- (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef;
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r160675 r160692  
    9898#import "WKProcessGroupPrivate.h"
    9999
    100 inline bool isWKContentAnchorRight(WKContentAnchor x)
    101 {
    102     return x == WKContentAnchorTopRight || x == WKContentAnchorBottomRight;
    103 }
    104 
    105 inline bool isWKContentAnchorBottom(WKContentAnchor x)
    106 {
    107     return x == WKContentAnchorBottomLeft || x == WKContentAnchorBottomRight;
    108 }
    109 
    110100@interface NSApplication (WKNSApplicationDetails)
    111101- (void)speakString:(NSString *)string;
     
    220210    String _promisedFilename;
    221211    String _promisedURL;
    222 
    223     // The frame origin can be seen as a position within the layer of painted page content where the
    224     // top left corner of the frame will be positioned. This is usually 0,0 - but if the content
    225     // anchor is set to a corner other than the top left, the origin will implicitly move as the
    226     // the frame size is modified.
    227     NSPoint _frameOrigin;
    228     WKContentAnchor _contentAnchor;
    229212   
    230213    NSSize _intrinsicContentSize;
     
    416399        _data->_windowHasValidBackingStore = NO;
    417400
    418     bool frameSizeUpdatesEnabled = ![self frameSizeUpdatesDisabled];
    419     NSPoint newFrameOrigin;
    420 
    421     // If frame updates are enabled we'll synchronously wait on the repaint, so we can reposition
    422     // the layers back to the origin. If frame updates are disabled then shift the layer position
    423     // so that the currently painted contents remain anchored appropriately.
    424     if (frameSizeUpdatesEnabled)
    425         newFrameOrigin = NSZeroPoint;
    426     else {
    427         newFrameOrigin = _data->_frameOrigin;
    428         if (isWKContentAnchorRight(_data->_contentAnchor))
    429             newFrameOrigin.x += [self frame].size.width - size.width;
    430         if (isWKContentAnchorBottom(_data->_contentAnchor))
    431             newFrameOrigin.y += [self frame].size.height - size.height;
    432     }
    433    
    434     // If the frame origin has changed then update the layer position.
    435     if (_data->_layerHostingView && !NSEqualPoints(_data->_frameOrigin, newFrameOrigin)) {
    436         _data->_frameOrigin = newFrameOrigin;
    437         CALayer *rootLayer = [[_data->_layerHostingView layer].sublayers objectAtIndex:0];
    438         [CATransaction begin];
    439         [CATransaction setDisableActions:YES];
    440         rootLayer.position = CGPointMake(-newFrameOrigin.x, -newFrameOrigin.y);
    441         [CATransaction commit];
    442     }
    443 
    444401    [super setFrameSize:size];
    445402
    446     if (frameSizeUpdatesEnabled) {
     403    if (![self frameSizeUpdatesDisabled]) {
    447404        if (_data->_clipsToVisibleRect)
    448405            [self _updateViewExposedRect];
     
    22022159        return;
    22032160   
    2204     NSSize layerOffset = NSMakeSize(_data->_frameOrigin.x, _data->_frameOrigin.y);
    2205     if (isWKContentAnchorRight(_data->_contentAnchor))
    2206         layerOffset.width += [self frame].size.width - size.width;
    2207     if (isWKContentAnchorBottom(_data->_contentAnchor))
    2208         layerOffset.height += [self frame].size.height - size.height;
    2209 
    2210     _data->_page->drawingArea()->setSize(IntSize(size), IntSize(layerOffset), IntSize(_data->_resizeScrollOffset));
     2161    _data->_page->drawingArea()->setSize(IntSize(size), IntSize(0, 0), IntSize(_data->_resizeScrollOffset));
    22112162    _data->_resizeScrollOffset = NSZeroSize;
    22122163}
     
    25172468}
    25182469
    2519 
    25202470- (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer
    25212471{
     
    25502500
    25512501            _data->_layerHostingView = nullptr;
    2552             _data->_frameOrigin = NSZeroPoint;
    25532502        }
    25542503    }
     
    29262875
    29272876    _data->_needsViewFrameInWindowCoordinates = _data->_page->pageGroup().preferences()->pluginsEnabled();
    2928     _data->_frameOrigin = NSZeroPoint;
    2929     _data->_contentAnchor = WKContentAnchorTopLeft;
    29302877   
    29312878    [self _registerDraggedTypes];
     
    32093156}
    32103157
    3211 - (void)setContentAnchor:(WKContentAnchor)contentAnchor
    3212 {
    3213     _data->_contentAnchor = contentAnchor;
    3214 }
    3215 
    3216 - (WKContentAnchor)contentAnchor
    3217 {
    3218     return _data->_contentAnchor;
    3219 }
    3220 
    32213158// This method forces a drawing area geometry update, even if frame size updates are disabled.
    32223159// The updated is performed asynchronously; we don't wait for the geometry update before returning.
Note: See TracChangeset for help on using the changeset viewer.