Title: [150194] trunk/Source/WebKit/mac
- Revision
- 150194
- Author
- simon.fra...@apple.com
- Date
- 2013-05-16 11:40:16 -0700 (Thu, 16 May 2013)
Log Message
Re-land r150168 with some OS version guards.
* WebView/WebFrameView.mm:
(-[WebFrameView drawRect:]):
(-[WebFrameView wantsUpdateLayer]):
(-[WebFrameView updateLayer]):
Modified Paths
Diff
Modified: trunk/Source/WebKit/mac/ChangeLog (150193 => 150194)
--- trunk/Source/WebKit/mac/ChangeLog 2013-05-16 18:30:55 UTC (rev 150193)
+++ trunk/Source/WebKit/mac/ChangeLog 2013-05-16 18:40:16 UTC (rev 150194)
@@ -1,3 +1,12 @@
+2013-05-16 Simon Fraser <simon.fra...@apple.com>
+
+ Re-land r150168 with some OS version guards.
+
+ * WebView/WebFrameView.mm:
+ (-[WebFrameView drawRect:]):
+ (-[WebFrameView wantsUpdateLayer]):
+ (-[WebFrameView updateLayer]):
+
2013-05-16 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r150168.
Modified: trunk/Source/WebKit/mac/WebView/WebFrameView.mm (150193 => 150194)
--- trunk/Source/WebKit/mac/WebView/WebFrameView.mm 2013-05-16 18:30:55 UTC (rev 150193)
+++ trunk/Source/WebKit/mac/WebView/WebFrameView.mm 2013-05-16 18:40:16 UTC (rev 150194)
@@ -79,6 +79,12 @@
- (BOOL)_scrollTo:(const NSPoint *)newOrigin animate:(BOOL)animate; // need the boolean result from this method
@end
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+@interface NSView (Details)
+- (void)setBackgroundColor:(NSColor *)color;
+@end
+#endif
+
enum {
SpaceKey = 0x0020
};
@@ -458,7 +464,7 @@
- (void)drawRect:(NSRect)rect
{
- if ([self documentView] == nil) {
+ if (![self documentView]) {
// Need to paint ourselves if there's no documentView to do it instead.
if ([[self _webView] drawsBackground]) {
[[[self _webView] backgroundColor] set];
@@ -474,6 +480,34 @@
}
}
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+- (BOOL)wantsUpdateLayer
+{
+ return YES;
+}
+
+- (void)updateLayer
+{
+ // Do what -drawRect: does but by setting a backgroundColor on the view. This avoids
+ // backing store for this view when the WebView is layer-backed.
+ if (![self documentView]) {
+ if ([[self _webView] drawsBackground]) {
+ [self setBackgroundColor:[[self _webView] backgroundColor]];
+ return;
+ }
+ } else {
+#ifndef NDEBUG
+ if ([[self _scrollView] drawsBackground]) {
+ [self setBackgroundColor:[NSColor cyanColor]];
+ return;
+ }
+#endif
+ }
+
+ [self setBackgroundColor:[NSColor clearColor]];
+}
+#endif
+
- (NSRect)visibleRect
{
// This method can be called beneath -[NSView dealloc] after we have cleared _private.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes