Title: [160692] trunk/Source/WebKit2
Revision
160692
Author
wei...@apple.com
Date
2013-12-16 19:48:05 -0800 (Mon, 16 Dec 2013)

Log 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:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (160691 => 160692)


--- trunk/Source/WebKit2/ChangeLog	2013-12-17 03:06:33 UTC (rev 160691)
+++ trunk/Source/WebKit2/ChangeLog	2013-12-17 03:48:05 UTC (rev 160692)
@@ -1,3 +1,17 @@
+2013-12-16  Sam Weinig  <s...@webkit.org>
+
+        [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:]):
+
 2013-12-16  Tim Horton  <timothy_hor...@apple.com>
 
         WebKit2 View Gestures: Pinching beyond the extremes doesn't animate back to the min/max

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h (160691 => 160692)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h	2013-12-17 03:06:33 UTC (rev 160691)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h	2013-12-17 03:48:05 UTC (rev 160692)
@@ -26,17 +26,6 @@
 #import <WebKit2/WKBase.h>
 #import <WebKit2/WKView.h>
 
-#if !TARGET_OS_IPHONE
-
-typedef enum {
-    WKContentAnchorTopLeft,
-    WKContentAnchorTopRight,
-    WKContentAnchorBottomLeft,
-    WKContentAnchorBottomRight,
-} WKContentAnchor;
-
-#endif
-
 @interface WKView (Private)
 
 /* C SPI support. */
@@ -53,8 +42,6 @@
 
 #if !TARGET_OS_IPHONE
 
-@property WKContentAnchor contentAnchor;
-
 - (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef;
 - (BOOL)canChangeFrameLayout:(WKFrameRef)frameRef;
 

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (160691 => 160692)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-12-17 03:06:33 UTC (rev 160691)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-12-17 03:48:05 UTC (rev 160692)
@@ -97,16 +97,6 @@
 #import "WKBrowsingContextGroupPrivate.h"
 #import "WKProcessGroupPrivate.h"
 
-inline bool isWKContentAnchorRight(WKContentAnchor x)
-{
-    return x == WKContentAnchorTopRight || x == WKContentAnchorBottomRight;
-}
-
-inline bool isWKContentAnchorBottom(WKContentAnchor x)
-{
-    return x == WKContentAnchorBottomLeft || x == WKContentAnchorBottomRight;
-}
-
 @interface NSApplication (WKNSApplicationDetails)
 - (void)speakString:(NSString *)string;
 - (void)_setCurrentEvent:(NSEvent *)event;
@@ -219,13 +209,6 @@
     RefPtr<WebCore::Image> _promisedImage;
     String _promisedFilename;
     String _promisedURL;
-
-    // The frame origin can be seen as a position within the layer of painted page content where the
-    // top left corner of the frame will be positioned. This is usually 0,0 - but if the content
-    // anchor is set to a corner other than the top left, the origin will implicitly move as the
-    // the frame size is modified.
-    NSPoint _frameOrigin;
-    WKContentAnchor _contentAnchor;
     
     NSSize _intrinsicContentSize;
     BOOL _clipsToVisibleRect;
@@ -415,35 +398,9 @@
     if (!NSEqualSizes(size, [self frame].size))
         _data->_windowHasValidBackingStore = NO;
 
-    bool frameSizeUpdatesEnabled = ![self frameSizeUpdatesDisabled];
-    NSPoint newFrameOrigin;
-
-    // If frame updates are enabled we'll synchronously wait on the repaint, so we can reposition
-    // the layers back to the origin. If frame updates are disabled then shift the layer position
-    // so that the currently painted contents remain anchored appropriately.
-    if (frameSizeUpdatesEnabled)
-        newFrameOrigin = NSZeroPoint;
-    else {
-        newFrameOrigin = _data->_frameOrigin;
-        if (isWKContentAnchorRight(_data->_contentAnchor))
-            newFrameOrigin.x += [self frame].size.width - size.width;
-        if (isWKContentAnchorBottom(_data->_contentAnchor))
-            newFrameOrigin.y += [self frame].size.height - size.height;
-    }
-    
-    // If the frame origin has changed then update the layer position.
-    if (_data->_layerHostingView && !NSEqualPoints(_data->_frameOrigin, newFrameOrigin)) {
-        _data->_frameOrigin = newFrameOrigin;
-        CALayer *rootLayer = [[_data->_layerHostingView layer].sublayers objectAtIndex:0];
-        [CATransaction begin];
-        [CATransaction setDisableActions:YES];
-        rootLayer.position = CGPointMake(-newFrameOrigin.x, -newFrameOrigin.y);
-        [CATransaction commit];
-    }
-
     [super setFrameSize:size];
 
-    if (frameSizeUpdatesEnabled) {
+    if (![self frameSizeUpdatesDisabled]) {
         if (_data->_clipsToVisibleRect)
             [self _updateViewExposedRect];
         [self _setDrawingAreaSize:size];
@@ -2201,13 +2158,7 @@
     if (!_data->_page->drawingArea())
         return;
     
-    NSSize layerOffset = NSMakeSize(_data->_frameOrigin.x, _data->_frameOrigin.y);
-    if (isWKContentAnchorRight(_data->_contentAnchor))
-        layerOffset.width += [self frame].size.width - size.width;
-    if (isWKContentAnchorBottom(_data->_contentAnchor))
-        layerOffset.height += [self frame].size.height - size.height;
-
-    _data->_page->drawingArea()->setSize(IntSize(size), IntSize(layerOffset), IntSize(_data->_resizeScrollOffset));
+    _data->_page->drawingArea()->setSize(IntSize(size), IntSize(0, 0), IntSize(_data->_resizeScrollOffset));
     _data->_resizeScrollOffset = NSZeroSize;
 }
 
@@ -2516,7 +2467,6 @@
     _data->_findIndicatorWindow->setFindIndicator(findIndicator, fadeOut, animate);
 }
 
-
 - (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer
 {
     [CATransaction begin];
@@ -2549,7 +2499,6 @@
             [_data->_layerHostingView setWantsLayer:NO];
 
             _data->_layerHostingView = nullptr;
-            _data->_frameOrigin = NSZeroPoint;
         }
     }
 
@@ -2925,8 +2874,6 @@
     _data->_intrinsicContentSize = NSMakeSize(NSViewNoInstrinsicMetric, NSViewNoInstrinsicMetric);
 
     _data->_needsViewFrameInWindowCoordinates = _data->_page->pageGroup().preferences()->pluginsEnabled();
-    _data->_frameOrigin = NSZeroPoint;
-    _data->_contentAnchor = WKContentAnchorTopLeft;
     
     [self _registerDraggedTypes];
 
@@ -3208,16 +3155,6 @@
     _data->_windowOcclusionDetectionEnabled = flag;
 }
 
-- (void)setContentAnchor:(WKContentAnchor)contentAnchor
-{
-    _data->_contentAnchor = contentAnchor;
-}
-
-- (WKContentAnchor)contentAnchor
-{
-    return _data->_contentAnchor;
-}
-
 // This method forces a drawing area geometry update, even if frame size updates are disabled.
 // The updated is performed asynchronously; we don't wait for the geometry update before returning.
 // The area drawn need not match the current frame size - if it differs it will be anchored to the
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to