diff options
Diffstat (limited to 'WebKit/mac/WebView/WebHTMLView.mm')
-rw-r--r-- | WebKit/mac/WebView/WebHTMLView.mm | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm index 02d32d9..ec2473f 100644 --- a/WebKit/mac/WebView/WebHTMLView.mm +++ b/WebKit/mac/WebView/WebHTMLView.mm @@ -456,6 +456,7 @@ struct WebHTMLViewInterpretKeyEventsParameters { #if USE(ACCELERATED_COMPOSITING) NSView *layerHostingView; + BOOL drawingIntoLayer; #endif NSEvent *mouseDownEvent; // Kept after handling the event. @@ -2232,6 +2233,22 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) return _private->printing; } +- (BOOL)_beginPrintModeWithMinimumPageWidth:(CGFloat)minimumPageWidth height:(CGFloat)minimumPageHeight maximumPageWidth:(CGFloat)maximumPageWidth +{ + Frame* frame = core([self _frame]); + if (!frame) + return NO; + + if (frame->document() && frame->document()->isFrameSet()) { + minimumPageWidth = 0; + minimumPageHeight = 0; + maximumPageWidth = 0; + } + + [self _setPrinting:YES minimumPageWidth:minimumPageWidth height:minimumPageHeight maximumPageWidth:maximumPageWidth adjustViewSize:YES paginateScreenContent:[self _isInScreenPaginationMode]]; + return YES; +} + - (BOOL)_beginPrintModeWithPageWidth:(float)pageWidth height:(float)pageHeight shrinkToFit:(BOOL)shrinkToFit { Frame* frame = core([self _frame]); @@ -3401,6 +3418,9 @@ WEBCORE_COMMAND(yankAndSelect) [webView _setNeedsOneShotDrawingSynchronization:NO]; } #endif + + if (webView) + CallUIDelegate(webView, @selector(webView:didDrawFrame:), [self _frame]); } // Turn off the additional clip while computing our visibleRect. @@ -5552,6 +5572,14 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) [viewLayer setTransform:CATransform3DMakeScale(scaleFactor, scaleFactor, 1)]; #endif + if ([self layer]) { + // If we are in a layer-backed view, we need to manually initialize the geometry for our layer. + [viewLayer setBounds:NSRectToCGRect([_private->layerHostingView bounds])]; + [viewLayer setAnchorPoint:CGPointMake(0, [self isFlipped] ? 1 : 0)]; + CGPoint layerPosition = NSPointToCGPoint([self convertPointToBase:[_private->layerHostingView frame].origin]); + [viewLayer setPosition:layerPosition]; + } + [_private->layerHostingView setLayer:viewLayer]; [_private->layerHostingView setWantsLayer:YES]; @@ -5591,8 +5619,6 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) NSRect layerViewFrame = [self bounds]; if (layerViewFrame.size.height > maxHeight) { - CGFloat documentHeight = layerViewFrame.size.height; - // Clamp the size of the view to <= maxHeight to avoid the bug. layerViewFrame.size.height = maxHeight; NSRect visibleRect = [[self enclosingScrollView] documentVisibleRect]; @@ -5602,14 +5628,34 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) layerViewFrame.origin.y = topOffset; // Compensate for the moved view by adjusting the sublayer transform on the view's layer (using flipped coords). - CGFloat bottomOffset = documentHeight - layerViewFrame.size.height - topOffset; - [[_private->layerHostingView layer] setSublayerTransform:CATransform3DMakeTranslation(0, -bottomOffset, 0)]; + CATransform3D flipTransform = CATransform3DMakeTranslation(0, topOffset, 0); + flipTransform = CATransform3DScale(flipTransform, 1, -1, 1); + [[_private->layerHostingView layer] setSublayerTransform:flipTransform]; } [_private->layerHostingView _updateLayerGeometryFromView]; // Workaround for <rdar://problem/7071636> [_private->layerHostingView setFrame:layerViewFrame]; } #endif // defined(BUILDING_ON_LEOPARD) + +- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx +{ + if (_private) { + ASSERT(!_private->drawingIntoLayer); + _private->drawingIntoLayer = YES; + } + + [super drawLayer:layer inContext:ctx]; + + if (_private) + _private->drawingIntoLayer = NO; +} + +- (BOOL)_web_isDrawingIntoLayer +{ + return _private->drawingIntoLayer; +} + #endif // USE(ACCELERATED_COMPOSITING) @end |