2 * Copyright (C) 2010 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #if USE(ACCELERATED_COMPOSITING)
30 #import "PlatformCALayer.h"
32 #import "BlockExceptions.h"
33 #import "FloatConversion.h"
34 #import "GraphicsContext.h"
35 #import "GraphicsLayerCA.h"
37 #import "WebTiledLayer.h"
38 #import <objc/objc-auto.h>
39 #import <objc/objc-runtime.h>
40 #import <QuartzCore/QuartzCore.h>
41 #import <wtf/CurrentTime.h>
42 #import <wtf/UnusedParam.h>
44 #define HAVE_MODERN_QUARTZCORE (!defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD))
46 using namespace WebCore;
48 // This value must be the same as in PlatformCAAnimationMac.mm
49 static NSString * const WKNonZeroBeginTimeFlag = @"WKPlatformCAAnimationNonZeroBeginTimeFlag";
51 static double mediaTimeToCurrentTime(CFTimeInterval t)
53 return WTF::currentTime() + t - CACurrentMediaTime();
56 // Delegate for animationDidStart callback
57 @interface WebAnimationDelegate : NSObject {
58 PlatformCALayer* m_owner;
61 - (void)animationDidStart:(CAAnimation *)anim;
62 - (void)setOwner:(PlatformCALayer*)owner;
66 @implementation WebAnimationDelegate
68 - (void)animationDidStart:(CAAnimation *)animation
70 // hasNonZeroBeginTime is stored in a key in the animation
71 bool hasNonZeroBeginTime = [[animation valueForKey:WKNonZeroBeginTimeFlag] boolValue];
72 CFTimeInterval startTime;
74 if (hasNonZeroBeginTime) {
75 // We don't know what time CA used to commit the animation, so just use the current time
76 // (even though this will be slightly off).
77 startTime = mediaTimeToCurrentTime(CACurrentMediaTime());
79 startTime = mediaTimeToCurrentTime([animation beginTime]);
82 m_owner->animationStarted(startTime);
85 - (void)setOwner:(PlatformCALayer*)owner
92 @interface CALayer(Private)
93 - (void)setContentsChanged;
94 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
95 - (void)setAcceleratesDrawing:(BOOL)flag;
96 - (BOOL)acceleratesDrawing;
100 static NSString * const platformCALayerPointer = @"WKPlatformCALayer";
102 bool PlatformCALayer::isValueFunctionSupported()
104 static bool sHaveValueFunction = [CAPropertyAnimation instancesRespondToSelector:@selector(setValueFunction:)];
105 return sHaveValueFunction;
108 void PlatformCALayer::setOwner(PlatformCALayerClient* owner)
112 // Change the delegate's owner if needed
114 [static_cast<WebAnimationDelegate*>(m_delegate.get()) setOwner:this];
117 static NSDictionary* nullActionsDictionary()
119 NSNull* nullValue = [NSNull null];
120 NSDictionary* actions = [NSDictionary dictionaryWithObjectsAndKeys:
121 nullValue, @"anchorPoint",
122 nullValue, @"bounds",
123 nullValue, @"contents",
124 nullValue, @"contentsRect",
125 nullValue, @"opacity",
126 nullValue, @"position",
127 nullValue, @"shadowColor",
128 nullValue, @"sublayerTransform",
129 nullValue, @"sublayers",
130 nullValue, @"transform",
131 nullValue, @"zPosition",
136 #if HAVE_MODERN_QUARTZCORE
137 static NSString* toCAFilterType(PlatformCALayer::FilterType type)
140 case PlatformCALayer::Linear: return kCAFilterLinear;
141 case PlatformCALayer::Nearest: return kCAFilterNearest;
142 case PlatformCALayer::Trilinear: return kCAFilterTrilinear;
148 PassRefPtr<PlatformCALayer> PlatformCALayer::create(LayerType layerType, PlatformCALayerClient* owner)
150 return adoptRef(new PlatformCALayer(layerType, 0, owner));
153 PassRefPtr<PlatformCALayer> PlatformCALayer::create(void* platformLayer, PlatformCALayerClient* owner)
155 return adoptRef(new PlatformCALayer(LayerTypeCustom, static_cast<PlatformLayer*>(platformLayer), owner));
158 PlatformCALayer::PlatformCALayer(LayerType layerType, PlatformLayer* layer, PlatformCALayerClient* owner)
161 BEGIN_BLOCK_OBJC_EXCEPTIONS
163 m_layerType = LayerTypeCustom;
166 m_layerType = layerType;
168 Class layerClass = Nil;
171 case LayerTypeRootLayer:
172 layerClass = [CALayer class];
174 case LayerTypeWebLayer:
175 layerClass = [WebLayer class];
177 case LayerTypeTransformLayer:
178 layerClass = NSClassFromString(@"CATransformLayer");
180 case LayerTypeWebTiledLayer:
181 layerClass = [WebTiledLayer class];
183 case LayerTypeCustom:
188 m_layer.adoptNS([[layerClass alloc] init]);
191 // Save a pointer to 'this' in the CALayer
192 [m_layer.get() setValue:[NSValue valueWithPointer:this] forKey:platformCALayerPointer];
194 // Clear all the implicit animations on the CALayer
195 [m_layer.get() setStyle:[NSDictionary dictionaryWithObject:nullActionsDictionary() forKey:@"actions"]];
197 // If this is a TiledLayer, set some initial values
198 if (m_layerType == LayerTypeWebTiledLayer) {
199 WebTiledLayer* tiledLayer = static_cast<WebTiledLayer*>(m_layer.get());
200 [tiledLayer setTileSize:CGSizeMake(GraphicsLayerCA::kTiledLayerTileSize, GraphicsLayerCA::kTiledLayerTileSize)];
201 [tiledLayer setLevelsOfDetail:1];
202 [tiledLayer setLevelsOfDetailBias:0];
203 [tiledLayer setContentsGravity:@"bottomLeft"];
206 END_BLOCK_OBJC_EXCEPTIONS
209 PlatformCALayer::~PlatformCALayer()
211 [m_layer.get() setValue:nil forKey:platformCALayerPointer];
213 // Clear the owner, which also clears it in the delegate to prevent attempts
214 // to use the GraphicsLayerCA after it has been destroyed.
217 // Remove the owner pointer from the delegate in case there is a pending animationStarted event.
218 [static_cast<WebAnimationDelegate*>(m_delegate.get()) setOwner:nil];
221 PlatformCALayer* PlatformCALayer::platformCALayer(void* platformLayer)
226 // Pointer to PlatformCALayer is kept in a key of the CALayer
227 PlatformCALayer* platformCALayer = nil;
228 BEGIN_BLOCK_OBJC_EXCEPTIONS
229 platformCALayer = static_cast<PlatformCALayer*>([[static_cast<CALayer*>(platformLayer) valueForKey:platformCALayerPointer] pointerValue]);
230 END_BLOCK_OBJC_EXCEPTIONS
231 return platformCALayer;
234 PlatformLayer* PlatformCALayer::platformLayer() const
236 return m_layer.get();
239 void PlatformCALayer::setNeedsDisplay(const FloatRect* dirtyRect)
241 BEGIN_BLOCK_OBJC_EXCEPTIONS
243 [m_layer.get() setNeedsDisplayInRect:*dirtyRect];
245 [m_layer.get() setNeedsDisplay];
246 END_BLOCK_OBJC_EXCEPTIONS
249 void PlatformCALayer::setContentsChanged()
251 BEGIN_BLOCK_OBJC_EXCEPTIONS
252 [m_layer.get() setContentsChanged];
253 END_BLOCK_OBJC_EXCEPTIONS
256 PlatformCALayer* PlatformCALayer::superlayer() const
258 return platformCALayer([m_layer.get() superlayer]);
261 void PlatformCALayer::removeFromSuperlayer()
263 BEGIN_BLOCK_OBJC_EXCEPTIONS
264 [m_layer.get() removeFromSuperlayer];
265 END_BLOCK_OBJC_EXCEPTIONS
268 void PlatformCALayer::setSublayers(const PlatformCALayerList& list)
270 // Short circuiting here not only avoids the allocation of sublayers, but avoids <rdar://problem/7390716> (see below)
271 if (list.size() == 0) {
272 removeAllSublayers();
276 BEGIN_BLOCK_OBJC_EXCEPTIONS
277 NSMutableArray* sublayers = [[NSMutableArray alloc] init];
278 for (size_t i = 0; i < list.size(); ++i)
279 [sublayers addObject:list[i]->m_layer.get()];
281 [m_layer.get() setSublayers:sublayers];
283 END_BLOCK_OBJC_EXCEPTIONS
286 void PlatformCALayer::removeAllSublayers()
288 // Workaround for <rdar://problem/7390716>: -[CALayer setSublayers:] crashes if sublayers is an empty array, or nil, under GC.
289 BEGIN_BLOCK_OBJC_EXCEPTIONS
290 if (objc_collectingEnabled())
291 while ([[m_layer.get() sublayers] count])
292 [[[m_layer.get() sublayers] objectAtIndex:0] removeFromSuperlayer];
294 [m_layer.get() setSublayers:nil];
295 END_BLOCK_OBJC_EXCEPTIONS
298 void PlatformCALayer::appendSublayer(PlatformCALayer* layer)
300 BEGIN_BLOCK_OBJC_EXCEPTIONS
301 [m_layer.get() addSublayer:layer->m_layer.get()];
302 END_BLOCK_OBJC_EXCEPTIONS
305 void PlatformCALayer::insertSublayer(PlatformCALayer* layer, size_t index)
307 BEGIN_BLOCK_OBJC_EXCEPTIONS
308 [m_layer.get() insertSublayer:layer->m_layer.get() atIndex:index];
309 END_BLOCK_OBJC_EXCEPTIONS
312 void PlatformCALayer::replaceSublayer(PlatformCALayer* reference, PlatformCALayer* layer)
314 BEGIN_BLOCK_OBJC_EXCEPTIONS
315 [m_layer.get() replaceSublayer:reference->m_layer.get() with:layer->m_layer.get()];
316 END_BLOCK_OBJC_EXCEPTIONS
319 size_t PlatformCALayer::sublayerCount() const
321 return [[m_layer.get() sublayers] count];
324 void PlatformCALayer::adoptSublayers(PlatformCALayer* source)
326 // Workaround for <rdar://problem/7390716>: -[CALayer setSublayers:] crashes if sublayers is an empty array, or nil, under GC.
327 NSArray* sublayers = [source->m_layer.get() sublayers];
329 if (objc_collectingEnabled() && ![sublayers count]) {
330 BEGIN_BLOCK_OBJC_EXCEPTIONS
331 while ([[m_layer.get() sublayers] count])
332 [[[m_layer.get() sublayers] objectAtIndex:0] removeFromSuperlayer];
333 END_BLOCK_OBJC_EXCEPTIONS
337 BEGIN_BLOCK_OBJC_EXCEPTIONS
338 [m_layer.get() setSublayers:sublayers];
339 END_BLOCK_OBJC_EXCEPTIONS
342 void PlatformCALayer::addAnimationForKey(const String& key, PlatformCAAnimation* animation)
346 WebAnimationDelegate* webAnimationDelegate = [[WebAnimationDelegate alloc] init];
347 m_delegate.adoptNS(webAnimationDelegate);
348 [webAnimationDelegate setOwner:this];
351 CAPropertyAnimation* propertyAnimation = static_cast<CAPropertyAnimation*>(animation->platformAnimation());
353 if (![propertyAnimation delegate])
354 [propertyAnimation setDelegate:static_cast<id>(m_delegate.get())];
356 BEGIN_BLOCK_OBJC_EXCEPTIONS
357 [m_layer.get() addAnimation:animation->m_animation.get() forKey:key];
358 END_BLOCK_OBJC_EXCEPTIONS
361 void PlatformCALayer::removeAnimationForKey(const String& key)
363 BEGIN_BLOCK_OBJC_EXCEPTIONS
364 [m_layer.get() removeAnimationForKey:key];
365 END_BLOCK_OBJC_EXCEPTIONS
368 PassRefPtr<PlatformCAAnimation> PlatformCALayer::animationForKey(const String& key)
370 CAPropertyAnimation* propertyAnimation = static_cast<CAPropertyAnimation*>([m_layer.get() animationForKey:key]);
371 if (!propertyAnimation)
373 return PlatformCAAnimation::create(propertyAnimation);
376 PlatformCALayer* PlatformCALayer::mask() const
378 return platformCALayer([m_layer.get() mask]);
381 void PlatformCALayer::setMask(PlatformCALayer* layer)
383 BEGIN_BLOCK_OBJC_EXCEPTIONS
384 [m_layer.get() setMask:layer ? layer->platformLayer() : 0];
385 END_BLOCK_OBJC_EXCEPTIONS
388 bool PlatformCALayer::isOpaque() const
390 return [m_layer.get() isOpaque];
393 void PlatformCALayer::setOpaque(bool value)
395 BEGIN_BLOCK_OBJC_EXCEPTIONS
396 [m_layer.get() setOpaque:value];
397 END_BLOCK_OBJC_EXCEPTIONS
400 FloatRect PlatformCALayer::bounds() const
402 return [m_layer.get() bounds];
405 void PlatformCALayer::setBounds(const FloatRect& value)
407 BEGIN_BLOCK_OBJC_EXCEPTIONS
408 [m_layer.get() setBounds:value];
409 END_BLOCK_OBJC_EXCEPTIONS
412 FloatPoint3D PlatformCALayer::position() const
414 CGPoint point = [m_layer.get() position];
415 return FloatPoint3D(point.x, point.y, [m_layer.get() zPosition]);
418 void PlatformCALayer::setPosition(const FloatPoint3D& value)
420 BEGIN_BLOCK_OBJC_EXCEPTIONS
421 [m_layer.get() setPosition:CGPointMake(value.x(), value.y())];
422 [m_layer.get() setZPosition:value.z()];
423 END_BLOCK_OBJC_EXCEPTIONS
426 FloatPoint3D PlatformCALayer::anchorPoint() const
428 CGPoint point = [m_layer.get() anchorPoint];
430 #if HAVE_MODERN_QUARTZCORE
431 z = [m_layer.get() anchorPointZ];
433 return FloatPoint3D(point.x, point.y, z);
436 void PlatformCALayer::setAnchorPoint(const FloatPoint3D& value)
438 BEGIN_BLOCK_OBJC_EXCEPTIONS
439 [m_layer.get() setAnchorPoint:CGPointMake(value.x(), value.y())];
440 #if HAVE_MODERN_QUARTZCORE
441 [m_layer.get() setAnchorPointZ:value.z()];
443 END_BLOCK_OBJC_EXCEPTIONS
446 TransformationMatrix PlatformCALayer::transform() const
448 return [m_layer.get() transform];
451 void PlatformCALayer::setTransform(const TransformationMatrix& value)
453 BEGIN_BLOCK_OBJC_EXCEPTIONS
454 [m_layer.get() setTransform:value];
455 END_BLOCK_OBJC_EXCEPTIONS
458 TransformationMatrix PlatformCALayer::sublayerTransform() const
460 return [m_layer.get() sublayerTransform];
463 void PlatformCALayer::setSublayerTransform(const TransformationMatrix& value)
465 BEGIN_BLOCK_OBJC_EXCEPTIONS
466 [m_layer.get() setSublayerTransform:value];
467 END_BLOCK_OBJC_EXCEPTIONS
470 TransformationMatrix PlatformCALayer::contentsTransform() const
472 #if !HAVE_MODERN_QUARTZCORE
473 if (m_layerType != LayerTypeWebLayer)
474 return TransformationMatrix();
476 return [static_cast<WebLayer*>(m_layer.get()) contentsTransform];
478 return TransformationMatrix();
482 void PlatformCALayer::setContentsTransform(const TransformationMatrix& value)
484 #if !HAVE_MODERN_QUARTZCORE
485 if (m_layerType != LayerTypeWebLayer)
488 BEGIN_BLOCK_OBJC_EXCEPTIONS
489 [m_layer.get() setContentsTransform:value];
490 END_BLOCK_OBJC_EXCEPTIONS
496 bool PlatformCALayer::isHidden() const
498 return [m_layer.get() isHidden];
501 void PlatformCALayer::setHidden(bool value)
503 BEGIN_BLOCK_OBJC_EXCEPTIONS
504 [m_layer.get() setHidden:value];
505 END_BLOCK_OBJC_EXCEPTIONS
508 bool PlatformCALayer::isGeometryFlipped() const
510 #if HAVE_MODERN_QUARTZCORE
511 return [m_layer.get() isGeometryFlipped];
517 void PlatformCALayer::setGeometryFlipped(bool value)
519 #if HAVE_MODERN_QUARTZCORE
520 BEGIN_BLOCK_OBJC_EXCEPTIONS
521 [m_layer.get() setGeometryFlipped:value];
522 END_BLOCK_OBJC_EXCEPTIONS
528 bool PlatformCALayer::isDoubleSided() const
530 return [m_layer.get() isDoubleSided];
533 void PlatformCALayer::setDoubleSided(bool value)
535 BEGIN_BLOCK_OBJC_EXCEPTIONS
536 [m_layer.get() setDoubleSided:value];
537 END_BLOCK_OBJC_EXCEPTIONS
540 bool PlatformCALayer::masksToBounds() const
542 return [m_layer.get() masksToBounds];
545 void PlatformCALayer::setMasksToBounds(bool value)
547 BEGIN_BLOCK_OBJC_EXCEPTIONS
548 [m_layer.get() setMasksToBounds:value];
549 END_BLOCK_OBJC_EXCEPTIONS
552 bool PlatformCALayer::acceleratesDrawing() const
554 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
555 return [m_layer.get() acceleratesDrawing];
561 void PlatformCALayer::setAcceleratesDrawing(bool acceleratesDrawing)
563 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
564 BEGIN_BLOCK_OBJC_EXCEPTIONS
565 [m_layer.get() setAcceleratesDrawing:acceleratesDrawing];
566 END_BLOCK_OBJC_EXCEPTIONS
568 UNUSED_PARAM(acceleratesDrawing);
572 CFTypeRef PlatformCALayer::contents() const
574 return [m_layer.get() contents];
577 void PlatformCALayer::setContents(CFTypeRef value)
579 BEGIN_BLOCK_OBJC_EXCEPTIONS
580 [m_layer.get() setContents:static_cast<id>(const_cast<void*>(value))];
581 END_BLOCK_OBJC_EXCEPTIONS
584 FloatRect PlatformCALayer::contentsRect() const
586 return [m_layer.get() contentsRect];
589 void PlatformCALayer::setContentsRect(const FloatRect& value)
591 BEGIN_BLOCK_OBJC_EXCEPTIONS
592 [m_layer.get() setContentsRect:value];
593 END_BLOCK_OBJC_EXCEPTIONS
596 void PlatformCALayer::setMinificationFilter(FilterType value)
598 #if HAVE_MODERN_QUARTZCORE
599 BEGIN_BLOCK_OBJC_EXCEPTIONS
600 [m_layer.get() setMinificationFilter:toCAFilterType(value)];
601 END_BLOCK_OBJC_EXCEPTIONS
607 void PlatformCALayer::setMagnificationFilter(FilterType value)
609 #if HAVE_MODERN_QUARTZCORE
610 BEGIN_BLOCK_OBJC_EXCEPTIONS
611 [m_layer.get() setMagnificationFilter:toCAFilterType(value)];
612 END_BLOCK_OBJC_EXCEPTIONS
618 Color PlatformCALayer::backgroundColor() const
620 return [m_layer.get() backgroundColor];
623 void PlatformCALayer::setBackgroundColor(const Color& value)
625 CGFloat components[4];
626 value.getRGBA(components[0], components[1], components[2], components[3]);
628 RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
629 RetainPtr<CGColorRef> color(AdoptCF, CGColorCreate(colorSpace.get(), components));
631 BEGIN_BLOCK_OBJC_EXCEPTIONS
632 [m_layer.get() setBackgroundColor:color.get()];
633 END_BLOCK_OBJC_EXCEPTIONS
636 float PlatformCALayer::borderWidth() const
638 return [m_layer.get() borderWidth];
641 void PlatformCALayer::setBorderWidth(float value)
643 BEGIN_BLOCK_OBJC_EXCEPTIONS
644 [m_layer.get() setBorderWidth:value];
645 END_BLOCK_OBJC_EXCEPTIONS
648 Color PlatformCALayer::borderColor() const
650 return [m_layer.get() borderColor];
653 void PlatformCALayer::setBorderColor(const Color& value)
655 CGFloat components[4];
656 value.getRGBA(components[0], components[1], components[2], components[3]);
658 RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
659 RetainPtr<CGColorRef> color(AdoptCF, CGColorCreate(colorSpace.get(), components));
661 BEGIN_BLOCK_OBJC_EXCEPTIONS
662 [m_layer.get() setBorderColor:color.get()];
663 END_BLOCK_OBJC_EXCEPTIONS
666 float PlatformCALayer::opacity() const
668 return [m_layer.get() opacity];
671 void PlatformCALayer::setOpacity(float value)
673 BEGIN_BLOCK_OBJC_EXCEPTIONS
674 [m_layer.get() setOpacity:value];
675 END_BLOCK_OBJC_EXCEPTIONS
678 String PlatformCALayer::name() const
680 return [m_layer.get() name];
683 void PlatformCALayer::setName(const String& value)
685 BEGIN_BLOCK_OBJC_EXCEPTIONS
686 [m_layer.get() setName:value];
687 END_BLOCK_OBJC_EXCEPTIONS
690 FloatRect PlatformCALayer::frame() const
692 return [m_layer.get() frame];
695 void PlatformCALayer::setFrame(const FloatRect& value)
697 BEGIN_BLOCK_OBJC_EXCEPTIONS
698 [m_layer.get() setFrame:value];
699 END_BLOCK_OBJC_EXCEPTIONS
702 float PlatformCALayer::speed() const
704 return [m_layer.get() speed];
707 void PlatformCALayer::setSpeed(float value)
709 BEGIN_BLOCK_OBJC_EXCEPTIONS
710 [m_layer.get() setSpeed:value];
711 END_BLOCK_OBJC_EXCEPTIONS
714 CFTimeInterval PlatformCALayer::timeOffset() const
716 return [m_layer.get() timeOffset];
719 void PlatformCALayer::setTimeOffset(CFTimeInterval value)
721 BEGIN_BLOCK_OBJC_EXCEPTIONS
722 [m_layer.get() setTimeOffset:value];
723 END_BLOCK_OBJC_EXCEPTIONS
726 float PlatformCALayer::contentsScale() const
728 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
729 return [m_layer.get() contentsScale];
735 void PlatformCALayer::setContentsScale(float value)
737 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
738 BEGIN_BLOCK_OBJC_EXCEPTIONS
739 [m_layer.get() setContentsScale:value];
740 END_BLOCK_OBJC_EXCEPTIONS
746 #endif // USE(ACCELERATED_COMPOSITING)