+2012-05-17 Andy Estes <aestes@apple.com>
+
+ Don't let -[CALayer renderInContext:] try to render WebView's root layer
+ https://bugs.webkit.org/show_bug.cgi?id=86773
+ <rdar://problem/10950075>
+
+ Reviewed by Dan Bernstein.
+
+ -[CALayer renderInContext:] doesn't correctly render our layer tree, so
+ don't let it try. Calling drawRect: with a bitmap context will already
+ do the right thing for WebViews.
+
+ * WebView/WebHTMLView.mm: Create a subclass of CALayer called WebLayerHostingLayer.
+ (-[WebLayerHostingLayer renderInContext:]): override renderInContext: to be a NOOP.
+ (-[WebHTMLView attachRootLayer:]): Create a WebLayerHostingLayer rather than a CALayer.
+
2012-05-17 Hironori Bono <hbono@chromium.org>
[Refactoring] Move platform-specific code in Editor::respondToChangedSelection to the WebKit layer
}
@end
+@interface WebRootLayer : CALayer
+@end
+
+@implementation WebRootLayer
+- (void)renderInContext:(CGContextRef)ctx
+{
+ // AppKit calls -[CALayer renderInContext:] to render layer-backed views
+ // into bitmap contexts, but renderInContext: doesn't capture mask layers
+ // (<rdar://problem/9539526>), so we can't rely on it. Since our layer
+ // contents will have already been rendered by drawRect:, we can safely make
+ // this a NOOP.
+}
+@end
+
// if YES, do the standard NSView hit test (which can't give the right result when HTML overlaps a view)
static BOOL forceNSViewHitTest;
}
// Make a container layer, which will get sized/positioned by AppKit and CA.
- CALayer* viewLayer = [CALayer layer];
+ CALayer* viewLayer = [WebRootLayer layer];
#ifdef BUILDING_ON_LEOPARD
// Turn off default animations.