WebCore:
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Dec 2007 06:49:14 +0000 (06:49 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Dec 2007 06:49:14 +0000 (06:49 +0000)
        Reviewed by Adele.

        Partial fix for <rdar://problem/5633400>
        Transformed <video>, <img>, <embed> are not clipped correctly until a repaint is forced

        Fix video painting when transform is applied.

        Test: media/video-transformed.html

        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
        (WebCore::MediaPlayerPrivate::paint):

LayoutTests:

        Reviewed by Adele.

        Test video painting when transform is applied.

        * media/video-paint-test.js: Added.
        * media/video-transformed.html: Added.
        * platform/mac/media/video-transformed-expected.checksum: Added.
        * platform/mac/media/video-transformed-expected.png: Added.
        * platform/mac/media/video-transformed-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28558 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/media/video-paint-test.js [new file with mode: 0644]
LayoutTests/media/video-transformed.html [new file with mode: 0644]
LayoutTests/platform/mac/media/video-transformed-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/media/video-transformed-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/media/video-transformed-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm

index 4f626f7..30f095d 100644 (file)
@@ -1,3 +1,15 @@
+2007-12-07  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Adele.
+        
+        Test video painting when transform is applied.
+
+        * media/video-paint-test.js: Added.
+        * media/video-transformed.html: Added.
+        * platform/mac/media/video-transformed-expected.checksum: Added.
+        * platform/mac/media/video-transformed-expected.png: Added.
+        * platform/mac/media/video-transformed-expected.txt: Added.
+
 2007-12-07  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/LayoutTests/media/video-paint-test.js b/LayoutTests/media/video-paint-test.js
new file mode 100644 (file)
index 0000000..2ece2f6
--- /dev/null
@@ -0,0 +1,20 @@
+function init()
+{
+    var count = document.getElementsByTagName('video').length;
+    document.addEventListener("load", function () {
+        if (!--count) {
+            document.body.offsetLeft;
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+        }
+    }, true);
+}
+
+if (window.layoutTestController) {
+    layoutTestController.waitUntilDone();
+    setTimeout(function() { 
+        document.body.appendChild(document.createTextNode('FAIL')); 
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    } , 8000);
+}
diff --git a/LayoutTests/media/video-transformed.html b/LayoutTests/media/video-transformed.html
new file mode 100644 (file)
index 0000000..595de7c
--- /dev/null
@@ -0,0 +1,9 @@
+<script src="video-paint-test.js"></script>
+<body onload="init()">
+<style>
+video { width:200px; border: 3px solid red; }
+</style>
+<p>Test painting of transformed video </p>
+&nbsp;<video src="content/test.mp4" style="-webkit-transform:rotate(20deg)"></video><br>
+&nbsp;<video src="content/test.mp4" style="-webkit-transform:scale(0.5)"></video><br>
+&nbsp;<video src="content/test.mp4" style="-webkit-transform:skew(20deg)"></video><br>
diff --git a/LayoutTests/platform/mac/media/video-transformed-expected.checksum b/LayoutTests/platform/mac/media/video-transformed-expected.checksum
new file mode 100644 (file)
index 0000000..0245a84
--- /dev/null
@@ -0,0 +1 @@
+d11f006c0dcc5752611c5190fcd634fe
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/media/video-transformed-expected.png b/LayoutTests/platform/mac/media/video-transformed-expected.png
new file mode 100644 (file)
index 0000000..64537c4
Binary files /dev/null and b/LayoutTests/platform/mac/media/video-transformed-expected.png differ
diff --git a/LayoutTests/platform/mac/media/video-transformed-expected.txt b/LayoutTests/platform/mac/media/video-transformed-expected.txt
new file mode 100644 (file)
index 0000000..c7915d5
--- /dev/null
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 217x18
+          text run at (0,0) width 217: "Test painting of transformed video"
+      RenderBlock (anonymous) at (0,34) size 784x480
+        RenderText {#text} at (0,142) size 4x18
+          text run at (0,142) width 4: " "
+        RenderBR {BR} at (210,156) size 0x0
+        RenderText {#text} at (0,302) size 4x18
+          text run at (0,302) width 4: " "
+        RenderBR {BR} at (210,316) size 0x0
+        RenderText {#text} at (0,462) size 4x18
+          text run at (0,462) width 4: " "
+        RenderBR {BR} at (210,476) size 0x0
+layer at (12,42) size 206x156
+  RenderVideo {VIDEO} at (4,0) size 206x156 [border: (3px solid #FF0000)]
+layer at (12,202) size 206x156
+  RenderVideo {VIDEO} at (4,160) size 206x156 [border: (3px solid #FF0000)]
+layer at (12,362) size 206x156
+  RenderVideo {VIDEO} at (4,320) size 206x156 [border: (3px solid #FF0000)]
index 254684c..d357093 100644 (file)
@@ -1,3 +1,17 @@
+2007-12-07  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Adele.
+        
+        Partial fix for <rdar://problem/5633400>
+        Transformed <video>, <img>, <embed> are not clipped correctly until a repaint is forced
+        
+        Fix video painting when transform is applied.
+
+        Test: media/video-transformed.html
+
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+        (WebCore::MediaPlayerPrivate::paint):
+
 2007-12-07  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Sam Weinig.
index 0f02ada..4ce5ac8 100644 (file)
@@ -585,7 +585,13 @@ void MediaPlayerPrivate::paint(GraphicsContext* context, const IntRect& r)
         return;
     [m_objcObserver.get() setDelayCallbacks:YES];
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    [view displayRectIgnoringOpacity:[view convertRect:r fromView:[view superview]]];
+    context->save();
+    context->translate(r.x(), r.y() + r.height());
+    context->scale(FloatSize(1.0f, -1.0f));
+    IntRect paintRect(IntPoint(0, 0), IntSize(r.width(), r.height()));
+    NSGraphicsContext* newContext = [NSGraphicsContext graphicsContextWithGraphicsPort:context->platformContext() flipped:NO];
+    [view displayRectIgnoringOpacity:paintRect inContext:newContext];
+    context->restore();
     END_BLOCK_OBJC_EXCEPTIONS;
     [m_objcObserver.get() setDelayCallbacks:NO];
 }