tizen beta release
[framework/web/webkit-efl.git] / Source / WebCore / platform / graphics / mac / WebLayer.mm
index 4425767..7b29b95 100755 (executable)
 #import <QuartzCore/QuartzCore.h>
 #import <wtf/UnusedParam.h>
 
+@interface CALayer(WebCoreCALayerPrivate)
+- (void)reloadValueForKeyPath:(NSString *)keyPath;
+@end
+
 using namespace WebCore;
 
 @implementation WebLayer
@@ -87,24 +91,31 @@ void drawLayerContents(CGContextRef context, CALayer *layer, WebCore::PlatformCA
         char text[16]; // that's a lot of repaints
         snprintf(text, sizeof(text), "%d", layerContents->platformCALayerIncrementRepaintCount());
 
+        CGRect indicatorBox = layerBounds;
+        indicatorBox.size.width = 12 + 10 * strlen(text);
+        indicatorBox.size.height = 27;
         CGContextSaveGState(context);
+        
+        CGContextSetAlpha(context, 0.5f);
+        CGContextBeginTransparencyLayerWithRect(context, indicatorBox, 0);
+
         if (isTiledLayer)
-            CGContextSetRGBFillColor(context, 0.0f, 1.0f, 0.0f, 0.8f);
+            CGContextSetRGBFillColor(context, 1, 0.5f, 0, 1);
         else
-            CGContextSetRGBFillColor(context, 1.0f, 0.0f, 0.0f, 0.8f);
+            CGContextSetRGBFillColor(context, 0, 0.5f, 0.25f, 1);
         
-        CGRect aBounds = layerBounds;
-
-        aBounds.size.width = 10 + 12 * strlen(text);
-        aBounds.size.height = 25;
-        CGContextFillRect(context, aBounds);
+        CGContextFillRect(context, indicatorBox);
         
-        CGContextSetRGBFillColor(context, 0.0f, 0.0f, 0.0f, 1.0f);
+        if (platformLayer->acceleratesDrawing())
+            CGContextSetRGBFillColor(context, 1, 0, 0, 1);
+        else
+            CGContextSetRGBFillColor(context, 1, 1, 1, 1);
 
-        CGContextSetTextMatrix(context, CGAffineTransformMakeScale(1.0f, -1.0f));
-        CGContextSelectFont(context, "Helvetica", 25, kCGEncodingMacRoman);
-        CGContextShowTextAtPoint(context, aBounds.origin.x + 3.0f, aBounds.origin.y + 20.0f, text, strlen(text));
+        CGContextSetTextMatrix(context, CGAffineTransformMakeScale(1, -1));
+        CGContextSelectFont(context, "Helvetica", 22, kCGEncodingMacRoman);
+        CGContextShowTextAtPoint(context, indicatorBox.origin.x + 5, indicatorBox.origin.y + 22, text, strlen(text));
         
+        CGContextEndTransparencyLayer(context);
         CGContextRestoreGState(context);        
     }
 
@@ -139,10 +150,12 @@ void setLayerNeedsDisplayInRect(CALayer *layer, WebCore::PlatformCALayerClient*
     }
 }
 
-// Disable default animations
 - (id<CAAction>)actionForKey:(NSString *)key
 {
-    UNUSED_PARAM(key);
+    // Fix for <rdar://problem/9015675>: Force the layer content to be updated when the tree is reparented.
+    if ([key isEqualToString:@"onOrderIn"])
+        [self reloadValueForKeyPath:@"contents"];
+
     return nil;
 }