Title: [186938] branches/safari-601.1-branch

Diff

Modified: branches/safari-601.1-branch/LayoutTests/ChangeLog (186937 => 186938)


--- branches/safari-601.1-branch/LayoutTests/ChangeLog	2015-07-17 05:32:55 UTC (rev 186937)
+++ branches/safari-601.1-branch/LayoutTests/ChangeLog	2015-07-17 05:33:00 UTC (rev 186938)
@@ -1,5 +1,26 @@
 2015-07-16  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r186868. rdar://problem/21758704
+
+    2015-07-15  Dean Jackson  <d...@apple.com>
+
+            Tag WebGL layers with sRGB colorspace
+            https://bugs.webkit.org/show_bug.cgi?id=146986
+            <rdar://problem/21758704>
+
+            Reviewed by Simon Fraser.
+
+            Add a test that embeds a WebGL canvas inside a solid div. Since both
+            have the same color, the canvas should seemlessly disappear into
+            the surrounding div.
+
+            * fast/canvas/webgl/match-page-color-space-expected.html: Added.
+            * fast/canvas/webgl/match-page-color-space.html: Added.
+            * platform/mac-mavericks/TestExpectations: Skip this test.
+            * platform/mac-yosemite/TestExpectations: Added. Skip this test.
+
+2015-07-16  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r186865. rdar://problem/21823835
 
     2015-07-15  Wenson Hsieh  <wenson_hs...@apple.com>

Added: branches/safari-601.1-branch/LayoutTests/fast/canvas/webgl/match-page-color-space-expected.html (0 => 186938)


--- branches/safari-601.1-branch/LayoutTests/fast/canvas/webgl/match-page-color-space-expected.html	                        (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/fast/canvas/webgl/match-page-color-space-expected.html	2015-07-17 05:33:00 UTC (rev 186938)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<style>
+.box {
+    position: relative;
+    display: inline-block;
+    margin: 5px;
+    width: 40px;
+    height: 40px;
+}
+</style>
+
+<p>The boxes below should all be uniform in color. Any difference is likely to be extremely subtle.</p>
+<div class="box" style="background-color: red"></div>
+<div class="box" style="background-color: yellow"></div>
+<div class="box" style="background-color: green"></div>
+<div class="box" style="background-color: orange"></div>
+<div class="box" style="background-color: purple"></div>
+<div class="box" style="background-color: gray"></div>
+<div class="box" style="background-color: cornflowerblue"></div>
+<div class="box" style="background-color: rgb(98, 178, 23)"></div>
+<div class="box" style="background-color: rgb(111, 62, 198)"></div>
+<div class="box" style="background-color: rgb(232, 176, 101)"></div>

Added: branches/safari-601.1-branch/LayoutTests/fast/canvas/webgl/match-page-color-space.html (0 => 186938)


--- branches/safari-601.1-branch/LayoutTests/fast/canvas/webgl/match-page-color-space.html	                        (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/fast/canvas/webgl/match-page-color-space.html	2015-07-17 05:33:00 UTC (rev 186938)
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<style>
+.box {
+    position: relative;
+    display: inline-block;
+    margin: 5px;
+    width: 40px;
+    height: 40px;
+}
+
+canvas {
+    position: absolute;
+    left: 10px;
+    top: 10px;
+    width: 20px;
+    height: 20px;
+    background-color: black;
+}
+</style>
+<script>
+
+function drawColorIntoCanvas(color, canvas) {
+    var gl = canvas.getContext("webgl");
+    gl.clearColor(color[0], color[1], color[2], 1.0);
+    gl.clear(gl.COLOR_BUFFER_BIT);
+}
+
+function run() {
+    var boxes = document.querySelectorAll(".box");
+    for (var i = 0; i < boxes.length; i++) {
+        var box = boxes[i];
+        var canvas = document.createElement("canvas");
+        canvas.width = 20;
+        canvas.height = 20;
+
+        var backgroundColor = window.getComputedStyle(box).backgroundColor;
+        var matches = /rgb\((\d+),\s(\d+),\s(\d+)\)/.exec(backgroundColor);
+        drawColorIntoCanvas([matches[1] / 255, matches[2] / 255, matches[3] / 255], canvas);
+        box.appendChild(canvas);
+    }
+}
+
+window.addEventListener("load", run, false);
+</script>
+<body>
+<p>The boxes below should all be uniform in color. Any difference is likely to be extremely subtle.</p>
+<div class="box" style="background-color: red"></div>
+<div class="box" style="background-color: yellow"></div>
+<div class="box" style="background-color: green"></div>
+<div class="box" style="background-color: orange"></div>
+<div class="box" style="background-color: purple"></div>
+<div class="box" style="background-color: gray"></div>
+<div class="box" style="background-color: cornflowerblue"></div>
+<div class="box" style="background-color: rgb(98, 178, 23)"></div>
+<div class="box" style="background-color: rgb(111, 62, 198)"></div>
+<div class="box" style="background-color: rgb(232, 176, 101)"></div>
+</body>
\ No newline at end of file

Modified: branches/safari-601.1-branch/LayoutTests/platform/mac-mavericks/TestExpectations (186937 => 186938)


--- branches/safari-601.1-branch/LayoutTests/platform/mac-mavericks/TestExpectations	2015-07-17 05:32:55 UTC (rev 186937)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac-mavericks/TestExpectations	2015-07-17 05:33:00 UTC (rev 186938)
@@ -18,3 +18,6 @@
 platform/mac/fast/ruby/ruby-expansion-cjk-2.html [ Skip ]
 platform/mac/fast/ruby/ruby-expansion-cjk-3.html [ Skip ]
 platform/mac/fast/ruby/ruby-expansion-cjk-4.html [ Skip ]
+
+# Colorspaces on CA OpenGL layers not available in Mavericks and Yosemite
+fast/canvas/webgl/match-page-color-space.html [ Skip ]

Added: branches/safari-601.1-branch/LayoutTests/platform/mac-yosemite/TestExpectations (0 => 186938)


--- branches/safari-601.1-branch/LayoutTests/platform/mac-yosemite/TestExpectations	                        (rev 0)
+++ branches/safari-601.1-branch/LayoutTests/platform/mac-yosemite/TestExpectations	2015-07-17 05:33:00 UTC (rev 186938)
@@ -0,0 +1,2 @@
+# Colorspaces on CA OpenGL layers not available in Mavericks and Yosemite
+fast/canvas/webgl/match-page-color-space.html [ Skip ]

Modified: branches/safari-601.1-branch/Source/WebCore/ChangeLog (186937 => 186938)


--- branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-07-17 05:32:55 UTC (rev 186937)
+++ branches/safari-601.1-branch/Source/WebCore/ChangeLog	2015-07-17 05:33:00 UTC (rev 186938)
@@ -1,5 +1,28 @@
 2015-07-16  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r186868. rdar://problem/21758704
+
+    2015-07-15  Dean Jackson  <d...@apple.com>
+
+            Tag WebGL layers with sRGB colorspace
+            https://bugs.webkit.org/show_bug.cgi?id=146986
+            <rdar://problem/21758704>
+
+            Reviewed by Simon Fraser.
+
+            Label a CAOpenGLLayer as using the sRGB colorspace,
+            like the rest of our page content.
+
+            Test: fast/canvas/webgl/match-page-color-space.html
+
+            * platform/graphics/mac/WebGLLayer.mm:
+            (-[WebGLLayer initWithGraphicsContext3D:]): Set the colorspace property on the layer.
+            (-[WebGLLayer copyCGLPixelFormatForDisplayMask:]):
+            (-[WebGLLayer drawInCGLContext:pixelFormat:forLayerTime:displayTime:]):
+            (-[WebGLLayer copyImageSnapshotWithColorSpace:]):
+
+2015-07-16  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r186865. rdar://problem/21823835
 
     2015-07-15  Wenson Hsieh  <wenson_hs...@apple.com>

Modified: branches/safari-601.1-branch/Source/WebCore/platform/graphics/mac/WebGLLayer.mm (186937 => 186938)


--- branches/safari-601.1-branch/Source/WebCore/platform/graphics/mac/WebGLLayer.mm	2015-07-17 05:32:55 UTC (rev 186937)
+++ branches/safari-601.1-branch/Source/WebCore/platform/graphics/mac/WebGLLayer.mm	2015-07-17 05:33:00 UTC (rev 186938)
@@ -30,13 +30,15 @@
 #import "WebGLLayer.h"
 
 #import "GraphicsContext3D.h"
+#import "GraphicsContextCG.h"
 #import "GraphicsLayer.h"
+#import <wtf/FastMalloc.h>
+#import <wtf/RetainPtr.h>
+
 #if !PLATFORM(IOS)
 #import <OpenGL/OpenGL.h>
 #import <OpenGL/gl.h>
 #endif
-#import <wtf/FastMalloc.h>
-#import <wtf/RetainPtr.h>
 
 using namespace WebCore;
 
@@ -49,9 +51,12 @@
     _context = context;
     self = [super init];
     _devicePixelRatio = context->getContextAttributes().devicePixelRatio;
-#if !PLATFORM(IOS)
+#if PLATFORM(MAC)
     self.contentsScale = _devicePixelRatio;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+    self.colorspace = sRGBColorSpaceRef();
 #endif
+#endif
     return self;
 }
 
@@ -59,7 +64,7 @@
 -(CGLPixelFormatObj)copyCGLPixelFormatForDisplayMask:(uint32_t)mask
 {
     // FIXME: The mask param tells you which display (on a multi-display system)
-    // is to be used. But since we are now getting the pixel format from the 
+    // is to be used. But since we are now getting the pixel format from the
     // Canvas CGL context, we don't use it. This seems to do the right thing on
     // one multi-display system. But there may be cases where this is not the case.
     // If needed we will have to set the display mask in the Canvas CGLContext and
@@ -98,7 +103,7 @@
 
     glEnable(GL_TEXTURE_2D);
     glBindTexture(GL_TEXTURE_2D, _context->platformTexture());
-    
+
     glBegin(GL_TRIANGLE_FAN);
         glTexCoord2f(0, 0);
         glVertex2f(-1, -1);
@@ -109,7 +114,7 @@
         glTexCoord2f(0, 1);
         glVertex2f(-1, 1);
     glEnd();
-    
+
     glBindTexture(GL_TEXTURE_2D, 0);
     glDisable(GL_TEXTURE_2D);
 
@@ -139,7 +144,7 @@
         imageColorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
 
     CGRect layerBounds = CGRectIntegral([self bounds]);
-    
+
     size_t width = layerBounds.size.width * _devicePixelRatio;
     size_t height = layerBounds.size.height * _devicePixelRatio;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to