More displaylist tests, and minor cleanup
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jan 2016 03:20:52 +0000 (03:20 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jan 2016 03:20:52 +0000 (03:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153198

Reviewed by Zalan Bujtas.

Source/WebCore:

Have the DisplayListRecorder's constructor push the recorder onto the GraphicsContext,
and remove that code from GraphicsLayerCA.

Tests: displaylists/extent-includes-shadow.html
       displaylists/extent-includes-transforms.html

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::recursiveCommitChanges):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::Recorder):

LayoutTests:

A couple more display list tests that check that the computed extent of an item
includes shadows and transforms.

WK1 results differ in that they disable should-subpixel-quantize-fonts in the state
(which is a bug).

Move some shared JS into a helper file.

* displaylists/extent-includes-shadow-expected.txt: Added.
* displaylists/extent-includes-shadow.html: Added.
* displaylists/extent-includes-transforms-expected.txt: Added.
* displaylists/extent-includes-transforms.html: Added.
* displaylists/layer-dispay-list.html:
* displaylists/resources/dump-target-display-list.js: Added.
(doTest):
* platform/mac-wk1/displaylists/extent-includes-shadow-expected.txt: Added.
* platform/mac-wk1/displaylists/extent-includes-transforms-expected.txt: Added.

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/displaylists/extent-includes-shadow-expected.txt [new file with mode: 0644]
LayoutTests/displaylists/extent-includes-shadow.html [new file with mode: 0644]
LayoutTests/displaylists/extent-includes-transforms-expected.txt [new file with mode: 0644]
LayoutTests/displaylists/extent-includes-transforms.html [new file with mode: 0644]
LayoutTests/displaylists/layer-dispay-list.html
LayoutTests/displaylists/resources/dump-target-display-list.js [new file with mode: 0644]
LayoutTests/platform/mac-wk1/displaylists/extent-includes-shadow-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk1/displaylists/extent-includes-transforms-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp

index 0721d89..63529cf 100644 (file)
@@ -1,3 +1,28 @@
+2016-01-17  Simon Fraser  <simon.fraser@apple.com>
+
+        More displaylist tests, and minor cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=153198
+
+        Reviewed by Zalan Bujtas.
+
+        A couple more display list tests that check that the computed extent of an item
+        includes shadows and transforms.
+
+        WK1 results differ in that they disable should-subpixel-quantize-fonts in the state
+        (which is a bug).
+
+        Move some shared JS into a helper file.
+
+        * displaylists/extent-includes-shadow-expected.txt: Added.
+        * displaylists/extent-includes-shadow.html: Added.
+        * displaylists/extent-includes-transforms-expected.txt: Added.
+        * displaylists/extent-includes-transforms.html: Added.
+        * displaylists/layer-dispay-list.html:
+        * displaylists/resources/dump-target-display-list.js: Added.
+        (doTest):
+        * platform/mac-wk1/displaylists/extent-includes-shadow-expected.txt: Added.
+        * platform/mac-wk1/displaylists/extent-includes-transforms-expected.txt: Added.
+
 2016-01-17  Brady Eidson  <beidson@apple.com>
 
         Modern IDB: .js test files should not log database names.
diff --git a/LayoutTests/displaylists/extent-includes-shadow-expected.txt b/LayoutTests/displaylists/extent-includes-shadow-expected.txt
new file mode 100644 (file)
index 0000000..39621a9
--- /dev/null
@@ -0,0 +1,21 @@
+
+(
+  (translate
+    (x 0.00)
+    (y 0.00)))
+(
+  (save
+    (restore-index 4)))
+(
+  (set-state
+    (change-flags 1024)
+    (shadow-blur 12.00)
+    (shadow-offset width=10 height=20)
+    (shadows-use-legacy-radius 0)))
+(
+  (fill-rect-with-color
+    (extent at (43,50) size 134x137)
+    (rect at (50,50) size 100x100)
+    (color #0000FF)))
+(
+  (restore))
diff --git a/LayoutTests/displaylists/extent-includes-shadow.html b/LayoutTests/displaylists/extent-includes-shadow.html
new file mode 100644 (file)
index 0000000..f401ad8
--- /dev/null
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        #target {
+            height: 200px;
+            width: 200px;
+            -webkit-transform: translateZ(0);
+        }
+        
+        .shadowed {
+            position: absolute;
+            top: 50px;
+            left: 50px;
+            width: 100px;
+            height: 100px;
+            background-color: blue;
+            box-shadow: 10px 20px 12px black;
+        }
+    </style>
+    <script src="resources/dump-target-display-list.js"></script>
+</head>
+<body>
+<div id="target">
+    <div class="shadowed"></div>
+</div>
+<pre id="output"></pre>
+</body>
+</html>
diff --git a/LayoutTests/displaylists/extent-includes-transforms-expected.txt b/LayoutTests/displaylists/extent-includes-transforms-expected.txt
new file mode 100644 (file)
index 0000000..4d6a356
--- /dev/null
@@ -0,0 +1,24 @@
+
+(
+  (translate
+    (x 0.00)
+    (y 22.00)))
+(
+  (concatentate-ctm
+    (ctm {m=((0.87,0.50)(-0.50,0.87)) t=(81.70,-18.30)})))
+(
+  (save
+    (restore-index 5)))
+(
+  (set-state
+    (change-flags 1024)
+    (shadow-blur 12.00)
+    (shadow-offset width=10 height=20)
+    (shadows-use-legacy-radius 0)))
+(
+  (fill-rect-with-color
+    (extent at (7.14,0.20) size 184.55x185.65)
+    (rect at (0,0) size 100x100)
+    (color #0000FF)))
+(
+  (restore))
diff --git a/LayoutTests/displaylists/extent-includes-transforms.html b/LayoutTests/displaylists/extent-includes-transforms.html
new file mode 100644 (file)
index 0000000..22888e3
--- /dev/null
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        #target {
+            height: 200px;
+            width: 200px;
+            -webkit-transform: translateZ(0);
+        }
+        
+        .transformed {
+            transform: rotate(30deg);
+            margin: 50px;
+        }
+        
+        .box {
+            width: 100px;
+            height: 100px;
+            background-color: blue;
+            box-shadow: 10px 20px 12px black;
+        }
+    </style>
+    <script src="resources/dump-target-display-list.js"></script>
+</head>
+<body>
+<div id="target">
+    <div class="transformed">
+        <div class="box"></div>
+    </div>
+</div>
+<pre id="output"></pre>
+</body>
+</html>
index b1a7a9e..ea34292 100644 (file)
             -webkit-transform: translateZ(0);
         }
     </style>
-    <script>
-        if (window.testRunner) {
-            testRunner.dumpAsText();
-            testRunner.waitUntilDone();
-        }
-
-        var targetDiv;
-        function doTest()
-        {
-            document.body.offsetWidth;
-            targetDiv = document.getElementById('target');
-            if (window.internals)
-                internals.setElementUsesDisplayListDrawing(targetDiv, true);
-            
-            window.setTimeout(function() {
-                if (window.internals) {
-                    var displayList = internals.displayListForElement(targetDiv);
-                    document.getElementById('output').textContent = displayList;
-                }
-                if (window.testRunner)
-                    testRunner.notifyDone();
-            }, 0);
-        }
-        window.addEventListener('load', doTest, false);
-    </script>
+    <script src="resources/dump-target-display-list.js"></script>
 </head>
 <body>
 <div id="target" class="composited box">
diff --git a/LayoutTests/displaylists/resources/dump-target-display-list.js b/LayoutTests/displaylists/resources/dump-target-display-list.js
new file mode 100644 (file)
index 0000000..df11314
--- /dev/null
@@ -0,0 +1,23 @@
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+var targetDiv;
+function doTest()
+{
+    document.body.offsetWidth;
+    targetDiv = document.getElementById('target');
+    if (window.internals)
+        internals.setElementUsesDisplayListDrawing(targetDiv, true);
+    
+    window.setTimeout(function() {
+        if (window.internals) {
+            var displayList = internals.displayListForElement(targetDiv);
+            document.getElementById('output').textContent = displayList;
+        }
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }, 0);
+}
+window.addEventListener('load', doTest, false);
diff --git a/LayoutTests/platform/mac-wk1/displaylists/extent-includes-shadow-expected.txt b/LayoutTests/platform/mac-wk1/displaylists/extent-includes-shadow-expected.txt
new file mode 100644 (file)
index 0000000..dedec74
--- /dev/null
@@ -0,0 +1,22 @@
+
+(
+  (translate
+    (x 0.00)
+    (y 0.00)))
+(
+  (save
+    (restore-index 4)))
+(
+  (set-state
+    (change-flags 1049600)
+    (shadow-blur 12.00)
+    (shadow-offset width=10 height=20)
+    (shadows-use-legacy-radius 0)
+    (should-subpixel-quantize-fonts 0)))
+(
+  (fill-rect-with-color
+    (extent at (43,50) size 134x137)
+    (rect at (50,50) size 100x100)
+    (color #0000FF)))
+(
+  (restore))
diff --git a/LayoutTests/platform/mac-wk1/displaylists/extent-includes-transforms-expected.txt b/LayoutTests/platform/mac-wk1/displaylists/extent-includes-transforms-expected.txt
new file mode 100644 (file)
index 0000000..e6b8012
--- /dev/null
@@ -0,0 +1,25 @@
+
+(
+  (translate
+    (x 0.00)
+    (y 22.00)))
+(
+  (concatentate-ctm
+    (ctm {m=((0.87,0.50)(-0.50,0.87)) t=(81.70,-18.30)})))
+(
+  (save
+    (restore-index 5)))
+(
+  (set-state
+    (change-flags 1049600)
+    (shadow-blur 12.00)
+    (shadow-offset width=10 height=20)
+    (shadows-use-legacy-radius 0)
+    (should-subpixel-quantize-fonts 0)))
+(
+  (fill-rect-with-color
+    (extent at (7.14,0.20) size 184.55x185.65)
+    (rect at (0,0) size 100x100)
+    (color #0000FF)))
+(
+  (restore))
index 7a106e2..63547f8 100644 (file)
@@ -1,3 +1,21 @@
+2016-01-17  Simon Fraser  <simon.fraser@apple.com>
+
+        More displaylist tests, and minor cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=153198
+
+        Reviewed by Zalan Bujtas.
+
+        Have the DisplayListRecorder's constructor push the recorder onto the GraphicsContext,
+        and remove that code from GraphicsLayerCA.
+
+        Tests: displaylists/extent-includes-shadow.html
+               displaylists/extent-includes-transforms.html
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::recursiveCommitChanges):
+        * platform/graphics/displaylists/DisplayListRecorder.cpp:
+        (WebCore::DisplayList::Recorder::Recorder):
+
 2016-01-16  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Remove TextRun::allowsRoundingHacks()
index 843d4cb..90b7c53 100644 (file)
@@ -1416,8 +1416,8 @@ void GraphicsLayerCA::recursiveCommitChanges(const CommitState& commitState, con
 
         GraphicsContext context;
         DisplayList::Recorder recorder(context, *m_displayList, initialClip, AffineTransform());
-        context.setDisplayListRecorder(&recorder);
         paintGraphicsLayerContents(context, FloatRect(FloatPoint(), size()));
+
 #ifdef LOG_RECORDING_TIME
         double duration = currentTime() - startTime;
         WTFLogAlways("Recording took %.5fms", duration * 1000.0);
index 366cff7..bc0f109 100644 (file)
@@ -41,9 +41,7 @@ Recorder::Recorder(GraphicsContext& context, DisplayList& displayList, const Flo
     , m_displayList(displayList)
 {
     LOG_WITH_STREAM(DisplayLists, stream << "\nRecording with clip " << initialClip);
-
-    // FIXME: Hook up recorder in the GraphicsContext.
-    // m_graphicsContext.setDisplayListRecorder(this);
+    m_graphicsContext.setDisplayListRecorder(this);
     m_stateStack.append(ContextState(baseCTM, initialClip));
 }