2009-09-25 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Sep 2009 22:01:43 +0000 (22:01 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Sep 2009 22:01:43 +0000 (22:01 +0000)
        Reviewed by Darin Adler.

        Crash with hardware accelerated rotation of a PDF image in a data URL
        <rdar://problem/7250378>

        PDF images don't return a color space from CGImageGetColorSpace(),
        so we need to null-check the return value before use.

        Test: compositing/color-matching/pdf-image-match.html

        * platform/graphics/mac/GraphicsLayerCA.mm:
        (WebCore::GraphicsLayerCA::setContentsToImage):

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

LayoutTests/ChangeLog
LayoutTests/compositing/color-matching/pdf-image-match.html [new file with mode: 0644]
LayoutTests/platform/mac/compositing/color-matching/pdf-image-match-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/compositing/color-matching/pdf-image-match-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/compositing/color-matching/pdf-image-match-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/graphics/mac/GraphicsLayerCA.mm

index d259e9a..25495f8 100644 (file)
@@ -1,3 +1,17 @@
+2009-09-25  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Crash with hardware accelerated rotation of a PDF image in a data URL
+        <rdar://problem/7250378>
+        
+        Testcase for a PDF image as the contents of a compositing layer.
+
+        * compositing/color-matching/pdf-image-match.html: Added.
+        * platform/mac/compositing/color-matching/pdf-image-match-expected.checksum: Added.
+        * platform/mac/compositing/color-matching/pdf-image-match-expected.png: Added.
+        * platform/mac/compositing/color-matching/pdf-image-match-expected.txt: Added.
+
 2009-09-25  Darin Adler  <darin@apple.com>
 
         Reviewed by Geoffrey Garen.
diff --git a/LayoutTests/compositing/color-matching/pdf-image-match.html b/LayoutTests/compositing/color-matching/pdf-image-match.html
new file mode 100644 (file)
index 0000000..75adb7f
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+        "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+  <title>Rotation Test</title>
+  <style type="text/css">
+
+    img.test {
+      width: 20px;
+      height: 20px;
+      -webkit-transform: translateZ(0);
+    }
+  </style>
+</head>
+<body>
+
+<p>This test should not crash</p>
+<img class="test" src="data:application/pdf;base64,JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRmlsdGVyIC9GbGF0ZURlY29kZSA+PgpzdHJlYW0KeAF9U7uO3DAM7PUV/IHwREqi5HqLA9Id9hMMJEiQKxZb5PczpGx5mxy8D3usIYej0YM+6EFC3/H9TZmNftHb7Sl0u1OO636jt3cAP5+x0MFvgo9u3Ei64nf/JGmZex+apAnXLoMca5x7jf9u3S7AlHtRfzNZJNY561DaSapxHVqTdOFYVNBJnL6Axqpo8coqmTfFmlX6BCDCmycpJ+tUiF6rdO0cLY7mUHEAS+FipTs8C4/25+HRc3eP1D3SjJklm98M9ZtP0sJbt6JQx5s0jHkiSTK3UTHL4hlbH1t1J4zFYjWsLQbaxqNgcSH4N5GGqX31wUo7XmWNxVfphZztT9bSuL+UrtwVYtPV/kAujS+8HwiOXzMm5YuYpCMmsAeEpjB8bBGTaQ8w4zwqbGongt2sMCyCMnlmCIUIBvWguD/IRUYerMR2wiAUuJA5KrycPLe1hEU9suLVEY0TWQoQFjf20jnDMqvXwdoLCiwFB4L0x/a/zLeTx0Xp75enp0I8HOnN/fAHQ2pb+hPkB+z937GrcQrbxhrUYn4o5+Mkf/wD8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gMjEwNCAvUm9vdCAxMyAwIFIgL1NpemUgMTY+PgpzdGFydHhyZWYKMjc0MQolJUVPRgo="/>
+
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/compositing/color-matching/pdf-image-match-expected.checksum b/LayoutTests/platform/mac/compositing/color-matching/pdf-image-match-expected.checksum
new file mode 100644 (file)
index 0000000..e6cd903
--- /dev/null
@@ -0,0 +1 @@
+aab69a7ec65adfef337cdc8c5fa5a66b
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/compositing/color-matching/pdf-image-match-expected.png b/LayoutTests/platform/mac/compositing/color-matching/pdf-image-match-expected.png
new file mode 100644 (file)
index 0000000..a91a8aa
Binary files /dev/null and b/LayoutTests/platform/mac/compositing/color-matching/pdf-image-match-expected.png differ
diff --git a/LayoutTests/platform/mac/compositing/color-matching/pdf-image-match-expected.txt b/LayoutTests/platform/mac/compositing/color-matching/pdf-image-match-expected.txt
new file mode 100644 (file)
index 0000000..275b507
--- /dev/null
@@ -0,0 +1,14 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x82
+  RenderBlock {HTML} at (0,0) size 800x82
+    RenderBody {BODY} at (8,16) size 784x58
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 160x18
+          text run at (0,0) width 160: "This test should not crash"
+      RenderBlock (anonymous) at (0,34) size 784x24
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+layer at (8,50) size 20x20
+  RenderImage {IMG} at (0,0) size 20x20
index 7aff711..407cc6b 100644 (file)
@@ -1,3 +1,18 @@
+2009-09-25  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Crash with hardware accelerated rotation of a PDF image in a data URL
+        <rdar://problem/7250378>
+        
+        PDF images don't return a color space from CGImageGetColorSpace(),
+        so we need to null-check the return value before use.
+
+        Test: compositing/color-matching/pdf-image-match.html
+
+        * platform/graphics/mac/GraphicsLayerCA.mm:
+        (WebCore::GraphicsLayerCA::setContentsToImage):
+
 2009-09-25  Darin Adler  <darin@apple.com>
 
         Reviewed by Geoffrey Garen.
index 2afcea4..e9960f1 100644 (file)
@@ -704,7 +704,7 @@ void GraphicsLayerCA::setContentsToImage(Image* image)
         CGColorSpaceRef colorSpace = CGImageGetColorSpace(m_pendingContentsImage.get());
 
         static CGColorSpaceRef deviceRGB = CGColorSpaceCreateDeviceRGB();
-        if (CFEqual(colorSpace, deviceRGB)) {
+        if (colorSpace && CFEqual(colorSpace, deviceRGB)) {
             // CoreGraphics renders images tagged with DeviceRGB using the color space of the main display. When we hand such
             // images to CA we need to tag them similarly so CA rendering matches CG rendering.
             static CGColorSpaceRef genericRGB = CGDisplayCopyColorSpace(kCGDirectMainDisplay);