summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/mac/WebLayer.mm
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics/mac/WebLayer.mm')
-rw-r--r--WebCore/platform/graphics/mac/WebLayer.mm49
1 files changed, 18 insertions, 31 deletions
diff --git a/WebCore/platform/graphics/mac/WebLayer.mm b/WebCore/platform/graphics/mac/WebLayer.mm
index 9bb8212..128e63b 100644
--- a/WebCore/platform/graphics/mac/WebLayer.mm
+++ b/WebCore/platform/graphics/mac/WebLayer.mm
@@ -30,7 +30,8 @@
#import "WebLayer.h"
#import "GraphicsContext.h"
-#import "GraphicsLayer.h"
+#import "GraphicsLayerCA.h"
+#import "PlatformCALayer.h"
#import <objc/objc-runtime.h>
#import <QuartzCore/QuartzCore.h>
#import <wtf/UnusedParam.h>
@@ -62,6 +63,11 @@ void drawLayerContents(CGContextRef context, CALayer *layer, WebCore::GraphicsLa
GraphicsContext graphicsContext(context);
+ if (!layerContents->contentsOpaque()) {
+ // Turn off font smoothing to improve the appearance of text rendered onto a transparent background.
+ graphicsContext.setShouldSmoothFonts(false);
+ }
+
// It's important to get the clip from the context, because it may be significantly
// smaller than the layer bounds (e.g. tiled layers)
CGRect clipBounds = CGContextGetClipBoundingBox(context);
@@ -146,58 +152,39 @@ void setLayerNeedsDisplayInRect(CALayer *layer, WebCore::GraphicsLayer* layerCon
return nil;
}
-// Implement this so presentationLayer can get our custom attributes
-- (id)initWithLayer:(id)layer
-{
- if ((self = [super initWithLayer:layer]))
- m_layerOwner = [(WebLayer*)layer layerOwner];
-
- return self;
-}
-
- (void)setNeedsDisplay
{
- if (m_layerOwner && m_layerOwner->client() && m_layerOwner->drawsContent())
+ PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
+ if (layer && layer->owner() && layer->owner()->client() && layer->owner()->drawsContent())
[super setNeedsDisplay];
}
- (void)setNeedsDisplayInRect:(CGRect)dirtyRect
{
- setLayerNeedsDisplayInRect(self, m_layerOwner, dirtyRect);
+ PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
+ if (layer)
+ setLayerNeedsDisplayInRect(self, layer->owner(), dirtyRect);
}
- (void)display
{
[super display];
- if (m_layerOwner)
- m_layerOwner->didDisplay(self);
+ PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
+ if (layer && layer->owner())
+ layer->owner()->didDisplay(self);
}
- (void)drawInContext:(CGContextRef)context
{
- drawLayerContents(context, self, m_layerOwner);
+ PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
+ if (layer)
+ drawLayerContents(context, self, layer->owner());
}
@end // implementation WebLayer
#pragma mark -
-@implementation WebLayer(WebLayerAdditions)
-
-- (void)setLayerOwner:(GraphicsLayer*)aLayer
-{
- m_layerOwner = aLayer;
-}
-
-- (GraphicsLayer*)layerOwner
-{
- return m_layerOwner;
-}
-
-@end
-
-#pragma mark -
-
#ifndef NDEBUG
@implementation CALayer(ExtendedDescription)