Changeset 160692 in webkit
- Timestamp:
- Dec 16, 2013 7:48:05 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r160686 r160692 1 2013-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 1 15 2013-12-16 Tim Horton <timothy_horton@apple.com> 2 16 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h
r160520 r160692 27 27 #import <WebKit2/WKView.h> 28 28 29 #if !TARGET_OS_IPHONE30 31 typedef enum {32 WKContentAnchorTopLeft,33 WKContentAnchorTopRight,34 WKContentAnchorBottomLeft,35 WKContentAnchorBottomRight,36 } WKContentAnchor;37 38 #endif39 40 29 @interface WKView (Private) 41 30 … … 53 42 54 43 #if !TARGET_OS_IPHONE 55 56 @property WKContentAnchor contentAnchor;57 44 58 45 - (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef; -
trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm
r160675 r160692 98 98 #import "WKProcessGroupPrivate.h" 99 99 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 110 100 @interface NSApplication (WKNSApplicationDetails) 111 101 - (void)speakString:(NSString *)string; … … 220 210 String _promisedFilename; 221 211 String _promisedURL; 222 223 // The frame origin can be seen as a position within the layer of painted page content where the224 // top left corner of the frame will be positioned. This is usually 0,0 - but if the content225 // anchor is set to a corner other than the top left, the origin will implicitly move as the226 // the frame size is modified.227 NSPoint _frameOrigin;228 WKContentAnchor _contentAnchor;229 212 230 213 NSSize _intrinsicContentSize; … … 416 399 _data->_windowHasValidBackingStore = NO; 417 400 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 reposition422 // the layers back to the origin. If frame updates are disabled then shift the layer position423 // 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 444 401 [super setFrameSize:size]; 445 402 446 if ( frameSizeUpdatesEnabled) {403 if (![self frameSizeUpdatesDisabled]) { 447 404 if (_data->_clipsToVisibleRect) 448 405 [self _updateViewExposedRect]; … … 2202 2159 return; 2203 2160 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)); 2211 2162 _data->_resizeScrollOffset = NSZeroSize; 2212 2163 } … … 2517 2468 } 2518 2469 2519 2520 2470 - (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer 2521 2471 { … … 2550 2500 2551 2501 _data->_layerHostingView = nullptr; 2552 _data->_frameOrigin = NSZeroPoint;2553 2502 } 2554 2503 } … … 2926 2875 2927 2876 _data->_needsViewFrameInWindowCoordinates = _data->_page->pageGroup().preferences()->pluginsEnabled(); 2928 _data->_frameOrigin = NSZeroPoint;2929 _data->_contentAnchor = WKContentAnchorTopLeft;2930 2877 2931 2878 [self _registerDraggedTypes]; … … 3209 3156 } 3210 3157 3211 - (void)setContentAnchor:(WKContentAnchor)contentAnchor3212 {3213 _data->_contentAnchor = contentAnchor;3214 }3215 3216 - (WKContentAnchor)contentAnchor3217 {3218 return _data->_contentAnchor;3219 }3220 3221 3158 // This method forces a drawing area geometry update, even if frame size updates are disabled. 3222 3159 // 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.