<!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">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[194816] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/194816">194816</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2016-01-08 22:07:33 -0800 (Fri, 08 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add display-list drawing hooks to platform-specific GraphicsContext files
https://bugs.webkit.org/show_bug.cgi?id=152940

Reviewed by Zalan Bujtas.

Call into the display list recorder for top-level entrypoints implemented in platform-specific
files.

The convention is that if a function begins with &quot;platform&quot;, it's not a top-level
entry point, and should only be called when there's a platform context (i.e. not
recording, and not paintingDisabled).

A few instances are stubbed out until we have a more complete display list implementation.

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawText):
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::getCTM):
(WebCore::GraphicsContext::savePlatformState):
(WebCore::GraphicsContext::restorePlatformState):
(WebCore::GraphicsContext::drawRect):
(WebCore::GraphicsContext::drawNativeImage):
(WebCore::GraphicsContext::drawLine):
(WebCore::GraphicsContext::drawEllipse):
(WebCore::GraphicsContext::drawConvexPolygon):
(WebCore::GraphicsContext::clipConvexPolygon):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::clipPath):
(WebCore::GraphicsContext::clipBounds):
(WebCore::GraphicsContext::drawLinesForText):
(WebCore::GraphicsContext::roundToDevicePixels):
(WebCore::GraphicsContext::translate):
(WebCore::GraphicsContext::setPlatformStrokeThickness):
(WebCore::GraphicsContext::setPlatformStrokeStyle):
(WebCore::GraphicsContext::concatCTM):
(WebCore::GraphicsContext::setCTM):
(WebCore::GraphicsContext::beginPlatformTransparencyLayer):
(WebCore::GraphicsContext::endPlatformTransparencyLayer):
(WebCore::GraphicsContext::clearRect):
(WebCore::GraphicsContext::strokeRect):
(WebCore::GraphicsContext::setLineCap):
(WebCore::GraphicsContext::setLineDash):
(WebCore::GraphicsContext::setLineJoin):
(WebCore::GraphicsContext::clipOut):
(WebCore::GraphicsContext::rotate):
(WebCore::GraphicsContext::scale):
(WebCore::GraphicsContext::platformFillRoundedRect):
(WebCore::GraphicsContext::fillRectWithRoundedHole):
(WebCore::GraphicsContext::drawPattern):
(WebCore::GraphicsContext::setPlatformShouldAntialias):
(WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
(WebCore::GraphicsContext::isAcceleratedContext):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::savePlatformState):
(WebCore::GraphicsContext::restorePlatformState):
(WebCore::GraphicsContext::drawNativeImage):
(WebCore::GraphicsContext::drawPattern):
(WebCore::GraphicsContext::drawRect):
(WebCore::GraphicsContext::drawLine):
(WebCore::GraphicsContext::drawEllipse):
(WebCore::GraphicsContext::drawConvexPolygon):
(WebCore::GraphicsContext::clipConvexPolygon):
(WebCore::GraphicsContext::applyStrokePattern):
(WebCore::GraphicsContext::applyFillPattern):
(WebCore::GraphicsContext::drawPath):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::strokePath):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::platformFillRoundedRect):
(WebCore::GraphicsContext::fillRectWithRoundedHole):
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::clipOut):
(WebCore::GraphicsContext::clipPath):
(WebCore::GraphicsContext::clipBounds):
(WebCore::GraphicsContext::beginPlatformTransparencyLayer):
(WebCore::GraphicsContext::endPlatformTransparencyLayer):
(WebCore::GraphicsContext::setPlatformShadow):
(WebCore::GraphicsContext::setMiterLimit):
(WebCore::GraphicsContext::clearRect):
(WebCore::GraphicsContext::strokeRect):
(WebCore::GraphicsContext::setLineCap):
(WebCore::GraphicsContext::setLineDash):
(WebCore::GraphicsContext::setLineJoin):
(WebCore::GraphicsContext::scale):
(WebCore::GraphicsContext::rotate):
(WebCore::GraphicsContext::translate):
(WebCore::GraphicsContext::concatCTM):
(WebCore::GraphicsContext::setCTM):
(WebCore::GraphicsContext::getCTM):
(WebCore::GraphicsContext::roundToDevicePixels):
(WebCore::GraphicsContext::drawLinesForText):
(WebCore::GraphicsContext::setURLForRect):
(WebCore::GraphicsContext::setIsCALayerContext):
(WebCore::GraphicsContext::isCALayerContext):
(WebCore::GraphicsContext::setIsAcceleratedContext):
(WebCore::GraphicsContext::isAcceleratedContext):
(WebCore::GraphicsContext::setPlatformTextDrawingMode):
(WebCore::GraphicsContext::setPlatformStrokeColor):
(WebCore::GraphicsContext::setPlatformStrokeThickness):
(WebCore::GraphicsContext::setPlatformFillColor):
(WebCore::GraphicsContext::setPlatformShouldAntialias):
(WebCore::GraphicsContext::setPlatformShouldSmoothFonts):
(WebCore::GraphicsContext::setPlatformAlpha):
(WebCore::GraphicsContext::setPlatformCompositeOperation):
(WebCore::GraphicsContext::platformApplyDeviceScaleFactor):
(WebCore::GraphicsContext::platformFillEllipse):
(WebCore::GraphicsContext::platformStrokeEllipse):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsContextcpp">trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscairoGraphicsContextCairocpp">trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscgGraphicsContextCGcpp">trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (194815 => 194816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-01-09 01:57:47 UTC (rev 194815)
+++ trunk/Source/WebCore/ChangeLog        2016-01-09 06:07:33 UTC (rev 194816)
</span><span class="lines">@@ -1,5 +1,118 @@
</span><span class="cx"> 2016-01-08  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Add display-list drawing hooks to platform-specific GraphicsContext files
+        https://bugs.webkit.org/show_bug.cgi?id=152940
+
+        Reviewed by Zalan Bujtas.
+
+        Call into the display list recorder for top-level entrypoints implemented in platform-specific
+        files.
+        
+        The convention is that if a function begins with &quot;platform&quot;, it's not a top-level
+        entry point, and should only be called when there's a platform context (i.e. not
+        recording, and not paintingDisabled).
+        
+        A few instances are stubbed out until we have a more complete display list implementation.
+
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::drawText):
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContext::getCTM):
+        (WebCore::GraphicsContext::savePlatformState):
+        (WebCore::GraphicsContext::restorePlatformState):
+        (WebCore::GraphicsContext::drawRect):
+        (WebCore::GraphicsContext::drawNativeImage):
+        (WebCore::GraphicsContext::drawLine):
+        (WebCore::GraphicsContext::drawEllipse):
+        (WebCore::GraphicsContext::drawConvexPolygon):
+        (WebCore::GraphicsContext::clipConvexPolygon):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::fillRect):
+        (WebCore::GraphicsContext::clip):
+        (WebCore::GraphicsContext::clipPath):
+        (WebCore::GraphicsContext::clipBounds):
+        (WebCore::GraphicsContext::drawLinesForText):
+        (WebCore::GraphicsContext::roundToDevicePixels):
+        (WebCore::GraphicsContext::translate):
+        (WebCore::GraphicsContext::setPlatformStrokeThickness):
+        (WebCore::GraphicsContext::setPlatformStrokeStyle):
+        (WebCore::GraphicsContext::concatCTM):
+        (WebCore::GraphicsContext::setCTM):
+        (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::endPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::clearRect):
+        (WebCore::GraphicsContext::strokeRect):
+        (WebCore::GraphicsContext::setLineCap):
+        (WebCore::GraphicsContext::setLineDash):
+        (WebCore::GraphicsContext::setLineJoin):
+        (WebCore::GraphicsContext::clipOut):
+        (WebCore::GraphicsContext::rotate):
+        (WebCore::GraphicsContext::scale):
+        (WebCore::GraphicsContext::platformFillRoundedRect):
+        (WebCore::GraphicsContext::fillRectWithRoundedHole):
+        (WebCore::GraphicsContext::drawPattern):
+        (WebCore::GraphicsContext::setPlatformShouldAntialias):
+        (WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
+        (WebCore::GraphicsContext::isAcceleratedContext):
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::savePlatformState):
+        (WebCore::GraphicsContext::restorePlatformState):
+        (WebCore::GraphicsContext::drawNativeImage):
+        (WebCore::GraphicsContext::drawPattern):
+        (WebCore::GraphicsContext::drawRect):
+        (WebCore::GraphicsContext::drawLine):
+        (WebCore::GraphicsContext::drawEllipse):
+        (WebCore::GraphicsContext::drawConvexPolygon):
+        (WebCore::GraphicsContext::clipConvexPolygon):
+        (WebCore::GraphicsContext::applyStrokePattern):
+        (WebCore::GraphicsContext::applyFillPattern):
+        (WebCore::GraphicsContext::drawPath):
+        (WebCore::GraphicsContext::fillPath):
+        (WebCore::GraphicsContext::strokePath):
+        (WebCore::GraphicsContext::fillRect):
+        (WebCore::GraphicsContext::platformFillRoundedRect):
+        (WebCore::GraphicsContext::fillRectWithRoundedHole):
+        (WebCore::GraphicsContext::clip):
+        (WebCore::GraphicsContext::clipOut):
+        (WebCore::GraphicsContext::clipPath):
+        (WebCore::GraphicsContext::clipBounds):
+        (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::endPlatformTransparencyLayer):
+        (WebCore::GraphicsContext::setPlatformShadow):
+        (WebCore::GraphicsContext::setMiterLimit):
+        (WebCore::GraphicsContext::clearRect):
+        (WebCore::GraphicsContext::strokeRect):
+        (WebCore::GraphicsContext::setLineCap):
+        (WebCore::GraphicsContext::setLineDash):
+        (WebCore::GraphicsContext::setLineJoin):
+        (WebCore::GraphicsContext::scale):
+        (WebCore::GraphicsContext::rotate):
+        (WebCore::GraphicsContext::translate):
+        (WebCore::GraphicsContext::concatCTM):
+        (WebCore::GraphicsContext::setCTM):
+        (WebCore::GraphicsContext::getCTM):
+        (WebCore::GraphicsContext::roundToDevicePixels):
+        (WebCore::GraphicsContext::drawLinesForText):
+        (WebCore::GraphicsContext::setURLForRect):
+        (WebCore::GraphicsContext::setIsCALayerContext):
+        (WebCore::GraphicsContext::isCALayerContext):
+        (WebCore::GraphicsContext::setIsAcceleratedContext):
+        (WebCore::GraphicsContext::isAcceleratedContext):
+        (WebCore::GraphicsContext::setPlatformTextDrawingMode):
+        (WebCore::GraphicsContext::setPlatformStrokeColor):
+        (WebCore::GraphicsContext::setPlatformStrokeThickness):
+        (WebCore::GraphicsContext::setPlatformFillColor):
+        (WebCore::GraphicsContext::setPlatformShouldAntialias):
+        (WebCore::GraphicsContext::setPlatformShouldSmoothFonts):
+        (WebCore::GraphicsContext::setPlatformAlpha):
+        (WebCore::GraphicsContext::setPlatformCompositeOperation):
+        (WebCore::GraphicsContext::platformApplyDeviceScaleFactor):
+        (WebCore::GraphicsContext::platformFillEllipse):
+        (WebCore::GraphicsContext::platformStrokeEllipse):
+
+2016-01-08  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
</ins><span class="cx">         Add DisplayList hooks into GraphicsContext
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=152932
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (194815 => 194816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp        2016-01-09 01:57:47 UTC (rev 194815)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp        2016-01-09 06:07:33 UTC (rev 194816)
</span><span class="lines">@@ -682,6 +682,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        // FIXME: Text drawing with display lists TBD.
+        return 0;
+    }
+
</ins><span class="cx">     return font.drawText(*this, run, point, from, to);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscairoGraphicsContextCairocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (194815 => 194816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp        2016-01-09 01:57:47 UTC (rev 194815)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp        2016-01-09 06:07:33 UTC (rev 194816)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;AffineTransform.h&quot;
</span><span class="cx"> #include &quot;CairoUtilities.h&quot;
</span><ins>+#include &quot;DisplayListRecorder.h&quot;
</ins><span class="cx"> #include &quot;DrawErrorUnderline.h&quot;
</span><span class="cx"> #include &quot;FloatConversion.h&quot;
</span><span class="cx"> #include &quot;FloatRect.h&quot;
</span><span class="lines">@@ -201,6 +202,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return AffineTransform();
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        WTFLogAlways(&quot;GraphicsContext::getCTM() is not yet compatible with recording contexts.&quot;);
+        return AffineTransform();
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx">     cairo_matrix_t m;
</span><span class="cx">     cairo_get_matrix(cr, &amp;m);
</span><span class="lines">@@ -214,12 +220,14 @@
</span><span class="cx"> 
</span><span class="cx"> void GraphicsContext::savePlatformState()
</span><span class="cx"> {
</span><ins>+    ASSERT(!isRecording());
</ins><span class="cx">     platformContext()-&gt;save();
</span><span class="cx">     m_data-&gt;save();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GraphicsContext::restorePlatformState()
</span><span class="cx"> {
</span><ins>+    ASSERT(!isRecording());
</ins><span class="cx">     platformContext()-&gt;restore();
</span><span class="cx">     m_data-&gt;restore();
</span><span class="cx"> 
</span><span class="lines">@@ -230,11 +238,16 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Draws a filled rectangle with a stroked border.
</span><del>-void GraphicsContext::drawRect(const FloatRect&amp; rect, float)
</del><ins>+void GraphicsContext::drawRect(const FloatRect&amp; rect, float borderThickness)
</ins><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawRect(rect, borderThickness);
+        return;
+    }
+
</ins><span class="cx">     ASSERT(!rect.isEmpty());
</span><span class="cx"> 
</span><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="lines">@@ -247,7 +260,7 @@
</span><span class="cx">         FloatRect r(rect);
</span><span class="cx">         r.inflate(-.5f);
</span><span class="cx">         cairo_rectangle(cr, r.x(), r.y(), r.width(), r.height());
</span><del>-        cairo_set_line_width(cr, 1.0);
</del><ins>+        cairo_set_line_width(cr, 1.0); // borderThickness?
</ins><span class="cx">         cairo_stroke(cr);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -256,8 +269,14 @@
</span><span class="cx"> 
</span><span class="cx"> void GraphicsContext::drawNativeImage(PassNativeImagePtr imagePtr, const FloatSize&amp; imageSize, const FloatRect&amp; destRect, const FloatRect&amp; srcRect, CompositeOperator op, BlendMode blendMode, ImageOrientation orientation)
</span><span class="cx"> {
</span><del>-    UNUSED_PARAM(imageSize);
</del><ins>+    if (paintingDisabled())
+        return;
</ins><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawNativeImage(imagePtr, imageSize, destRect, srcRect, op, blendMode, orientation);
+        return;
+    }
+
</ins><span class="cx">     NativeImagePtr image = imagePtr;
</span><span class="cx"> 
</span><span class="cx">     platformContext()-&gt;save();
</span><span class="lines">@@ -295,6 +314,11 @@
</span><span class="cx">     if (strokeStyle() == NoStroke)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawLine(point1, point2);
+        return;
+    }
+
</ins><span class="cx">     const Color&amp; strokeColor = this-&gt;strokeColor();
</span><span class="cx">     float thickness = strokeThickness();
</span><span class="cx">     bool isVerticalLine = (point1.x() + thickness == point2.x());
</span><span class="lines">@@ -384,6 +408,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawEllipse(rect);
+        return;
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx">     cairo_save(cr);
</span><span class="cx">     float yRadius = .5 * rect.height();
</span><span class="lines">@@ -414,6 +443,11 @@
</span><span class="cx">     if (npoints &lt;= 1)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawConvexPolygon(npoints, points, shouldAntialias);
+        return;
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx"> 
</span><span class="cx">     cairo_save(cr);
</span><span class="lines">@@ -444,6 +478,11 @@
</span><span class="cx">     if (numPoints &lt;= 1)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;clipConvexPolygon(numPoints, points, antialiased);
+        return;
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx"> 
</span><span class="cx">     cairo_new_path(cr);
</span><span class="lines">@@ -464,6 +503,11 @@
</span><span class="cx">     if (paintingDisabled() || path.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;fillPath(path);
+        return;
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx">     setPathOnCairoContext(cr, path.platformPath()-&gt;context());
</span><span class="cx">     shadowAndFillCurrentCairoPath(*this);
</span><span class="lines">@@ -474,6 +518,11 @@
</span><span class="cx">     if (paintingDisabled() || path.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;strokePath(path);
+        return;
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx">     setPathOnCairoContext(cr, path.platformPath()-&gt;context());
</span><span class="cx">     shadowAndStrokeCurrentCairoPath(*this);
</span><span class="lines">@@ -484,6 +533,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;fillRect(rect);
+        return;
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx">     cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
</span><span class="cx">     shadowAndFillCurrentCairoPath(*this);
</span><span class="lines">@@ -494,6 +548,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;fillRect(rect, color);
+        return;
+    }
+
</ins><span class="cx">     if (hasShadow())
</span><span class="cx">         platformContext()-&gt;shadowBlur().drawRectShadow(*this, FloatRoundedRect(rect));
</span><span class="cx"> 
</span><span class="lines">@@ -505,6 +564,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;clip(rect);
+        return;
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx">     cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
</span><span class="cx">     cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);
</span><span class="lines">@@ -527,6 +591,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;clipPath(path, clipRule);
+        return;
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx">     if (!path.isNull())
</span><span class="cx">         setPathOnCairoContext(cr, path.platformPath()-&gt;context());
</span><span class="lines">@@ -552,6 +621,14 @@
</span><span class="cx"> 
</span><span class="cx"> IntRect GraphicsContext::clipBounds() const
</span><span class="cx"> {
</span><ins>+    if (paintingDisabled())
+        return IntRect();
+
+    if (isRecording()) {
+        WTFLogAlways(&quot;Getting the clip bounds not yet supported with display lists&quot;);
+        return IntRect(-2048, -2048, 4096, 4096); // FIXME: display lists.
+    }
+
</ins><span class="cx">     double x1, x2, y1, y2;
</span><span class="cx">     cairo_clip_extents(platformContext()-&gt;cr(), &amp;x1, &amp;y1, &amp;x2, &amp;y2);
</span><span class="cx">     return enclosingIntRect(FloatRect(x1, y1, x2 - x1, y2 - y1));
</span><span class="lines">@@ -663,6 +740,11 @@
</span><span class="cx">     if (widths.size() &lt;= 0)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawLinesForText(point, widths, printing, doubleUnderlines, strokeThickness());
+        return;
+    }
+
</ins><span class="cx">     Color localStrokeColor(strokeColor());
</span><span class="cx"> 
</span><span class="cx">     FloatRect bounds = computeLineBoundsAndAntialiasingModeForText(point, widths.last(), printing, localStrokeColor);
</span><span class="lines">@@ -720,6 +802,14 @@
</span><span class="cx"> 
</span><span class="cx"> FloatRect GraphicsContext::roundToDevicePixels(const FloatRect&amp; frect, RoundingMode)
</span><span class="cx"> {
</span><ins>+    if (paintingDisabled())
+        return frect;
+
+    if (!isRecording()) {
+        WTFLogAlways(&quot;GraphicsContext::roundToDevicePixels() is not yet compatible with recording contexts.&quot;);
+        return frect;
+    }
+
</ins><span class="cx">     FloatRect result;
</span><span class="cx">     double x = frect.x();
</span><span class="cx">     double y = frect.y();
</span><span class="lines">@@ -760,6 +850,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;translate(x, y);
+        return;
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx">     cairo_translate(cr, x, y);
</span><span class="cx">     m_data-&gt;translate(x, y);
</span><span class="lines">@@ -782,6 +877,8 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ASSERT(!isRecording());
+
</ins><span class="cx">     cairo_set_line_width(platformContext()-&gt;cr(), strokeThickness);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -793,6 +890,8 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ASSERT(!isRecording());
+
</ins><span class="cx">     switch (strokeStyle) {
</span><span class="cx">     case NoStroke:
</span><span class="cx">         // FIXME: is it the right way to emulate NoStroke?
</span><span class="lines">@@ -822,6 +921,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;concatCTM(transform);
+        return;
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx">     const cairo_matrix_t matrix = cairo_matrix_t(transform);
</span><span class="cx">     cairo_transform(cr, &amp;matrix);
</span><span class="lines">@@ -833,6 +937,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        WTFLogAlways(&quot;GraphicsContext::setCTM() is not compatible with recording contexts.&quot;);
+        return;
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx">     const cairo_matrix_t matrix = cairo_matrix_t(transform);
</span><span class="cx">     cairo_set_matrix(cr, &amp;matrix);
</span><span class="lines">@@ -870,6 +979,8 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ASSERT(!isRecording());
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx">     cairo_push_group(cr);
</span><span class="cx">     m_data-&gt;layers.append(opacity);
</span><span class="lines">@@ -880,6 +991,8 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ASSERT(!isRecording());
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx"> 
</span><span class="cx">     cairo_pop_group_to_source(cr);
</span><span class="lines">@@ -897,6 +1010,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;clearRect(rect);
+        return;
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx"> 
</span><span class="cx">     cairo_save(cr);
</span><span class="lines">@@ -911,6 +1029,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;strokeRect(rect, width);
+        return;
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx">     cairo_save(cr);
</span><span class="cx">     cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
</span><span class="lines">@@ -924,6 +1047,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;setLineCap(lineCap);
+        return;
+    }
+
</ins><span class="cx">     cairo_line_cap_t cairoCap = CAIRO_LINE_CAP_BUTT;
</span><span class="cx">     switch (lineCap) {
</span><span class="cx">     case ButtCap:
</span><span class="lines">@@ -950,6 +1078,14 @@
</span><span class="cx"> 
</span><span class="cx"> void GraphicsContext::setLineDash(const DashArray&amp; dashes, float dashOffset)
</span><span class="cx"> {
</span><ins>+    if (paintingDisabled())
+        return;
+
+    if (isRecording()) {
+        m_displayListRecorder-&gt;setLineDash(dashes, dashOffset);
+        return;
+    }
+
</ins><span class="cx">     if (isDashArrayAllZero(dashes))
</span><span class="cx">         cairo_set_dash(platformContext()-&gt;cr(), 0, 0, 0);
</span><span class="cx">     else
</span><span class="lines">@@ -961,6 +1097,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;setLineJoin(lineJoin);
+        return;
+    }
+
</ins><span class="cx">     cairo_line_join_t cairoJoin = CAIRO_LINE_JOIN_MITER;
</span><span class="cx">     switch (lineJoin) {
</span><span class="cx">     case MiterJoin:
</span><span class="lines">@@ -1013,6 +1154,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;clipOut(path);
+        return;
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx">     double x1, y1, x2, y2;
</span><span class="cx">     cairo_clip_extents(cr, &amp;x1, &amp;y1, &amp;x2, &amp;y2);
</span><span class="lines">@@ -1030,6 +1176,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;rotate(radians);
+        return;
+    }
+
</ins><span class="cx">     cairo_rotate(platformContext()-&gt;cr(), radians);
</span><span class="cx">     m_data-&gt;rotate(radians);
</span><span class="cx"> }
</span><span class="lines">@@ -1039,6 +1190,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;scale(size);
+        return;
+    }
+
</ins><span class="cx">     cairo_scale(platformContext()-&gt;cr(), size.width(), size.height());
</span><span class="cx">     m_data-&gt;scale(size);
</span><span class="cx"> }
</span><span class="lines">@@ -1048,6 +1204,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;clipOut(r);
+        return;
+    }
+
</ins><span class="cx">     cairo_t* cr = platformContext()-&gt;cr();
</span><span class="cx">     double x1, y1, x2, y2;
</span><span class="cx">     cairo_clip_extents(cr, &amp;x1, &amp;y1, &amp;x2, &amp;y2);
</span><span class="lines">@@ -1064,6 +1225,8 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ASSERT(!isRecording());
+
</ins><span class="cx">     if (hasShadow())
</span><span class="cx">         platformContext()-&gt;shadowBlur().drawRectShadow(*this, rect);
</span><span class="cx"> 
</span><span class="lines">@@ -1082,6 +1245,11 @@
</span><span class="cx">     if (paintingDisabled() || !color.isValid())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;fillRectWithRoundedHole(rect, roundedHoleRect, color);
+        return;
+    }
+
</ins><span class="cx">     if (this-&gt;mustUseShadowBlur())
</span><span class="cx">         platformContext()-&gt;shadowBlur().drawInsetShadow(*this, rect, roundedHoleRect);
</span><span class="cx"> 
</span><span class="lines">@@ -1099,8 +1267,16 @@
</span><span class="cx">     cairo_restore(cr);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GraphicsContext::drawPattern(Image&amp; image, const FloatRect&amp; tileRect, const AffineTransform&amp; patternTransform, const FloatPoint&amp; phase, const FloatSize&amp;, CompositeOperator op, const FloatRect&amp; destRect, BlendMode)
</del><ins>+void GraphicsContext::drawPattern(Image&amp; image, const FloatRect&amp; tileRect, const AffineTransform&amp; patternTransform, const FloatPoint&amp; phase, const FloatSize&amp; spacing, CompositeOperator op, const FloatRect&amp; destRect, BlendMode blendMode)
</ins><span class="cx"> {
</span><ins>+    if (paintingDisabled())
+        return;
+
+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawPattern(image, tileRect, patternTransform, phase, spacing, op, destRect, blendMode);
+        return;
+    }
+
</ins><span class="cx">     RefPtr&lt;cairo_surface_t&gt; surface = image.nativeImageForCurrentFrame();
</span><span class="cx">     if (!surface) // If it's too early we won't have an image yet.
</span><span class="cx">         return;
</span><span class="lines">@@ -1114,6 +1290,8 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ASSERT(!isRecording());
+
</ins><span class="cx">     // When true, use the default Cairo backend antialias mode (usually this
</span><span class="cx">     // enables standard 'grayscale' antialiasing); false to explicitly disable
</span><span class="cx">     // antialiasing. This is the same strategy as used in drawConvexPolygon().
</span><span class="lines">@@ -1122,11 +1300,16 @@
</span><span class="cx"> 
</span><span class="cx"> void GraphicsContext::setPlatformImageInterpolationQuality(InterpolationQuality quality)
</span><span class="cx"> {
</span><ins>+    ASSERT(!isRecording());
+
</ins><span class="cx">     platformContext()-&gt;setImageInterpolationQuality(quality);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool GraphicsContext::isAcceleratedContext() const
</span><span class="cx"> {
</span><ins>+    if (isRecording())
+        return false;
+
</ins><span class="cx">     return cairo_surface_get_type(cairo_get_target(platformContext()-&gt;cr())) == CAIRO_SURFACE_TYPE_GL;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscgGraphicsContextCGcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (194815 => 194816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp        2016-01-09 01:57:47 UTC (rev 194815)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp        2016-01-09 06:07:33 UTC (rev 194816)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;AffineTransform.h&quot;
</span><span class="cx"> #include &quot;CoreGraphicsSPI.h&quot;
</span><ins>+#include &quot;DisplayListRecorder.h&quot;
</ins><span class="cx"> #include &quot;FloatConversion.h&quot;
</span><span class="cx"> #include &quot;GraphicsContextPlatformPrivateCG.h&quot;
</span><span class="cx"> #include &quot;ImageBuffer.h&quot;
</span><span class="lines">@@ -141,6 +142,8 @@
</span><span class="cx"> void GraphicsContext::savePlatformState()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!paintingDisabled());
</span><ins>+    ASSERT(!isRecording());
+
</ins><span class="cx">     // Note: Do not use this function within this class implementation, since we want to avoid the extra
</span><span class="cx">     // save of the secondary context (in GraphicsContextPlatformPrivateCG.h).
</span><span class="cx">     CGContextSaveGState(platformContext());
</span><span class="lines">@@ -150,6 +153,8 @@
</span><span class="cx"> void GraphicsContext::restorePlatformState()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!paintingDisabled());
</span><ins>+    ASSERT(!isRecording());
+
</ins><span class="cx">     // Note: Do not use this function within this class implementation, since we want to avoid the extra
</span><span class="cx">     // restore of the secondary context (in GraphicsContextPlatformPrivateCG.h).
</span><span class="cx">     CGContextRestoreGState(platformContext());
</span><span class="lines">@@ -162,6 +167,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawNativeImage(imagePtr, imageSize, destRect, srcRect, op, blendMode, orientation);
+        return;
+    }
+
</ins><span class="cx">     RetainPtr&lt;CGImageRef&gt; image(imagePtr);
</span><span class="cx"> 
</span><span class="cx">     float currHeight = orientation.usesWidthAsHeight() ? CGImageGetWidth(image.get()) : CGImageGetHeight(image.get());
</span><span class="lines">@@ -279,6 +289,11 @@
</span><span class="cx">     if (paintingDisabled() || !patternTransform.isInvertible())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawPattern(image, tileRect, patternTransform, phase, spacing, op, destRect, blendMode);
+        return;
+    }
+
</ins><span class="cx">     CGContextRef context = platformContext();
</span><span class="cx">     CGContextStateSaver stateSaver(context);
</span><span class="cx">     CGContextClipToRect(context, destRect);
</span><span class="lines">@@ -379,6 +394,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawRect(rect, borderThickness);
+        return;
+    }
+
</ins><span class="cx">     // FIXME: this function does not handle patterns and gradients like drawPath does, it probably should.
</span><span class="cx">     ASSERT(!rect.isEmpty());
</span><span class="cx"> 
</span><span class="lines">@@ -412,6 +432,11 @@
</span><span class="cx">     if (strokeStyle() == NoStroke)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawLine(point1, point2);
+        return;
+    }
+
</ins><span class="cx">     float thickness = strokeThickness();
</span><span class="cx">     bool isVerticalLine = (point1.x() + thickness == point2.x());
</span><span class="cx">     float strokeWidth = isVerticalLine ? point2.y() - point1.y() : point2.x() - point1.x();
</span><span class="lines">@@ -497,6 +522,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawEllipse(rect);
+        return;
+    }
+
</ins><span class="cx">     Path path;
</span><span class="cx">     path.addEllipse(rect);
</span><span class="cx">     drawPath(path);
</span><span class="lines">@@ -520,6 +550,11 @@
</span><span class="cx">     if (numberOfPoints &lt;= 1)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawConvexPolygon(numberOfPoints, points, antialiased);
+        return;
+    }
+
</ins><span class="cx">     CGContextRef context = platformContext();
</span><span class="cx"> 
</span><span class="cx">     if (antialiased != shouldAntialias())
</span><span class="lines">@@ -541,6 +576,11 @@
</span><span class="cx">     if (numberOfPoints &lt;= 1)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;clipConvexPolygon(numberOfPoints, points, antialias);
+        return;
+    }
+
</ins><span class="cx">     CGContextRef context = platformContext();
</span><span class="cx"> 
</span><span class="cx">     if (antialias != shouldAntialias())
</span><span class="lines">@@ -559,6 +599,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;applyStrokePattern();
+        return;
+    }
+
</ins><span class="cx">     CGContextRef cgContext = platformContext();
</span><span class="cx">     AffineTransform userToBaseCTM = AffineTransform(getUserToBaseCTM(cgContext));
</span><span class="cx"> 
</span><span class="lines">@@ -578,6 +623,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;applyFillPattern();
+        return;
+    }
+
</ins><span class="cx">     CGContextRef cgContext = platformContext();
</span><span class="cx">     AffineTransform userToBaseCTM = AffineTransform(getUserToBaseCTM(cgContext));
</span><span class="cx"> 
</span><span class="lines">@@ -624,6 +674,11 @@
</span><span class="cx">     if (paintingDisabled() || path.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawPath(path);
+        return;
+    }
+
</ins><span class="cx">     CGContextRef context = platformContext();
</span><span class="cx">     const GraphicsContextState&amp; state = m_state;
</span><span class="cx"> 
</span><span class="lines">@@ -661,6 +716,11 @@
</span><span class="cx">     if (paintingDisabled() || path.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;fillPath(path);
+        return;
+    }
+
</ins><span class="cx">     CGContextRef context = platformContext();
</span><span class="cx"> 
</span><span class="cx">     if (m_state.fillGradient) {
</span><span class="lines">@@ -715,6 +775,11 @@
</span><span class="cx">     if (paintingDisabled() || path.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;strokePath(path);
+        return;
+    }
+
</ins><span class="cx">     CGContextRef context = platformContext();
</span><span class="cx"> 
</span><span class="cx">     CGContextBeginPath(context);
</span><span class="lines">@@ -772,6 +837,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;fillRect(rect);
+        return;
+    }
+
</ins><span class="cx">     CGContextRef context = platformContext();
</span><span class="cx"> 
</span><span class="cx">     if (m_state.fillGradient) {
</span><span class="lines">@@ -820,6 +890,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;fillRect(rect, color);
+        return;
+    }
+
</ins><span class="cx">     CGContextRef context = platformContext();
</span><span class="cx">     Color oldFillColor = fillColor();
</span><span class="cx"> 
</span><span class="lines">@@ -849,6 +924,8 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+    
+    ASSERT(!isRecording());
</ins><span class="cx"> 
</span><span class="cx">     CGContextRef context = platformContext();
</span><span class="cx">     Color oldFillColor = fillColor();
</span><span class="lines">@@ -891,6 +968,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;fillRectWithRoundedHole(rect, roundedHoleRect, color);
+        return;
+    }
+
</ins><span class="cx">     CGContextRef context = platformContext();
</span><span class="cx"> 
</span><span class="cx">     Path path;
</span><span class="lines">@@ -932,6 +1014,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;clip(rect);
+        return;
+    }
+
</ins><span class="cx">     CGContextClipToRect(platformContext(), rect);
</span><span class="cx">     m_data-&gt;clip(rect);
</span><span class="cx"> }
</span><span class="lines">@@ -941,6 +1028,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;clipOut(rect);
+        return;
+    }
+
</ins><span class="cx">     // FIXME: Using CGRectInfinite is much faster than getting the clip bounding box. However, due
</span><span class="cx">     // to &lt;rdar://problem/12584492&gt;, CGRectInfinite can't be used with an accelerated context that
</span><span class="cx">     // has certain transforms that aren't just a translation or a scale. And due to &lt;rdar://problem/14634453&gt;
</span><span class="lines">@@ -953,11 +1045,33 @@
</span><span class="cx">     CGContextEOClip(platformContext());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GraphicsContext::clipOut(const Path&amp; path)
+{
+    if (paintingDisabled())
+        return;
+
+    if (isRecording()) {
+        m_displayListRecorder-&gt;clipOut(path);
+        return;
+    }
+
+    CGContextBeginPath(platformContext());
+    CGContextAddRect(platformContext(), CGContextGetClipBoundingBox(platformContext()));
+    if (!path.isEmpty())
+        CGContextAddPath(platformContext(), path.platformPath());
+    CGContextEOClip(platformContext());
+}
+
</ins><span class="cx"> void GraphicsContext::clipPath(const Path&amp; path, WindRule clipRule)
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;clipPath(path, clipRule);
+        return;
+    }
+
</ins><span class="cx">     CGContextRef context = platformContext();
</span><span class="cx">     if (path.isEmpty())
</span><span class="cx">         CGContextClipToRect(context, CGRectZero);
</span><span class="lines">@@ -979,6 +1093,12 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return IntRect();
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        WTFLogAlways(&quot;Getting the clip bounds not yet supported with display lists&quot;);
+        return IntRect(-2048, -2048, 4096, 4096); // FIXME: display lists.
+    }
+
+
</ins><span class="cx">     return enclosingIntRect(CGContextGetClipBoundingBox(platformContext()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -987,6 +1107,8 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ASSERT(!isRecording());
+
</ins><span class="cx">     save();
</span><span class="cx"> 
</span><span class="cx">     CGContextRef context = platformContext();
</span><span class="lines">@@ -999,6 +1121,9 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    ASSERT(!isRecording());
+
</ins><span class="cx">     CGContextRef context = platformContext();
</span><span class="cx">     CGContextEndTransparencyLayer(context);
</span><span class="cx"> 
</span><span class="lines">@@ -1042,6 +1167,8 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    ASSERT(!isRecording());
</ins><span class="cx">     
</span><span class="cx">     // FIXME: we could avoid the shadow setup cost when we know we'll render the shadow ourselves.
</span><span class="cx"> 
</span><span class="lines">@@ -1092,6 +1219,13 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    if (isRecording()) {
+        // Maybe this should be part of the state.
+        m_displayListRecorder-&gt;setMiterLimit(limit);
+        return;
+    }
+
</ins><span class="cx">     CGContextSetMiterLimit(platformContext(), limit);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1099,6 +1233,12 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    if (isRecording()) {
+        m_displayListRecorder-&gt;clearRect(r);
+        return;
+    }
+
</ins><span class="cx">     CGContextClearRect(platformContext(), r);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1107,6 +1247,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;strokeRect(rect, lineWidth);
+        return;
+    }
+
</ins><span class="cx">     CGContextRef context = platformContext();
</span><span class="cx"> 
</span><span class="cx">     if (m_state.strokeGradient) {
</span><span class="lines">@@ -1171,6 +1316,12 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    if (isRecording()) {
+        m_displayListRecorder-&gt;setLineCap(cap);
+        return;
+    }
+
</ins><span class="cx">     switch (cap) {
</span><span class="cx">     case ButtCap:
</span><span class="cx">         CGContextSetLineCap(platformContext(), kCGLineCapButt);
</span><span class="lines">@@ -1189,6 +1340,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;setLineDash(dashes, dashOffset);
+        return;
+    }
+
</ins><span class="cx">     if (dashOffset &lt; 0) {
</span><span class="cx">         float length = 0;
</span><span class="cx">         for (size_t i = 0; i &lt; dashes.size(); ++i)
</span><span class="lines">@@ -1203,6 +1359,12 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    if (isRecording()) {
+        m_displayListRecorder-&gt;setLineJoin(join);
+        return;
+    }
+
</ins><span class="cx">     switch (join) {
</span><span class="cx">     case MiterJoin:
</span><span class="cx">         CGContextSetLineJoin(platformContext(), kCGLineJoinMiter);
</span><span class="lines">@@ -1221,22 +1383,16 @@
</span><span class="cx">     clipPath(path, fillRule);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GraphicsContext::clipOut(const Path&amp; path)
</del><ins>+void GraphicsContext::scale(const FloatSize&amp; size)
</ins><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    CGContextBeginPath(platformContext());
-    CGContextAddRect(platformContext(), CGContextGetClipBoundingBox(platformContext()));
-    if (!path.isEmpty())
-        CGContextAddPath(platformContext(), path.platformPath());
-    CGContextEOClip(platformContext());
-}
</del><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;scale(size);
+        return;
+    }
</ins><span class="cx"> 
</span><del>-void GraphicsContext::scale(const FloatSize&amp; size)
-{
-    if (paintingDisabled())
-        return;
</del><span class="cx">     CGContextScaleCTM(platformContext(), size.width(), size.height());
</span><span class="cx">     m_data-&gt;scale(size);
</span><span class="cx">     m_data-&gt;m_userToDeviceTransformKnownToBeIdentity = false;
</span><span class="lines">@@ -1246,6 +1402,12 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    if (isRecording()) {
+        m_displayListRecorder-&gt;rotate(angle);
+        return;
+    }
+
</ins><span class="cx">     CGContextRotateCTM(platformContext(), angle);
</span><span class="cx">     m_data-&gt;rotate(angle);
</span><span class="cx">     m_data-&gt;m_userToDeviceTransformKnownToBeIdentity = false;
</span><span class="lines">@@ -1255,6 +1417,12 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    if (isRecording()) {
+        m_displayListRecorder-&gt;translate(x, y);
+        return;
+    }
+
</ins><span class="cx">     CGContextTranslateCTM(platformContext(), x, y);
</span><span class="cx">     m_data-&gt;translate(x, y);
</span><span class="cx">     m_data-&gt;m_userToDeviceTransformKnownToBeIdentity = false;
</span><span class="lines">@@ -1264,6 +1432,12 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    if (isRecording()) {
+        m_displayListRecorder-&gt;concatCTM(transform);
+        return;
+    }
+
</ins><span class="cx">     CGContextConcatCTM(platformContext(), transform);
</span><span class="cx">     m_data-&gt;concatCTM(transform);
</span><span class="cx">     m_data-&gt;m_userToDeviceTransformKnownToBeIdentity = false;
</span><span class="lines">@@ -1273,6 +1447,12 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    if (isRecording()) {
+        WTFLogAlways(&quot;GraphicsContext::setCTM() is not compatible with recording contexts.&quot;);
+        return;
+    }
+
</ins><span class="cx">     CGContextSetCTM(platformContext(), transform);
</span><span class="cx">     m_data-&gt;setCTM(transform);
</span><span class="cx">     m_data-&gt;m_userToDeviceTransformKnownToBeIdentity = false;
</span><span class="lines">@@ -1283,6 +1463,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return AffineTransform();
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        WTFLogAlways(&quot;GraphicsContext::getCTM() is not yet compatible with recording contexts.&quot;);
+        return AffineTransform();
+    }
+
</ins><span class="cx">     // The CTM usually includes the deviceScaleFactor except in WebKit 1 when the
</span><span class="cx">     // content is non-composited, since the scale factor is integrated at a lower
</span><span class="cx">     // level. To guarantee the deviceScale is included, we can use this CG API.
</span><span class="lines">@@ -1297,6 +1482,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return rect;
</span><span class="cx"> 
</span><ins>+    if (!isRecording()) {
+        WTFLogAlways(&quot;GraphicsContext::roundToDevicePixels() is not yet compatible with recording contexts.&quot;);
+        return rect;
+    }
+
</ins><span class="cx">     // It is not enough just to round to pixels in device space. The rotation part of the
</span><span class="cx">     // affine transform matrix to device space can mess with this conversion if we have a
</span><span class="cx">     // rotating image like the hands of the world clock widget. We just need the scale, so
</span><span class="lines">@@ -1355,6 +1545,11 @@
</span><span class="cx">     if (!widths.size())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawLinesForText(point, widths, printing, doubleLines, strokeThickness());
+        return;
+    }
+
</ins><span class="cx">     Color localStrokeColor(strokeColor());
</span><span class="cx"> 
</span><span class="cx">     FloatRect bounds = computeLineBoundsAndAntialiasingModeForText(point, widths.last(), printing, localStrokeColor);
</span><span class="lines">@@ -1387,6 +1582,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        WTFLogAlways(&quot;GraphicsContext::setURLForRect() is not yet compatible with recording contexts.&quot;);
+        return; // FIXME for display lists.
+    }
+
</ins><span class="cx">     RetainPtr&lt;CFURLRef&gt; urlRef = link.createCFURL();
</span><span class="cx">     if (!urlRef)
</span><span class="cx">         return;
</span><span class="lines">@@ -1438,6 +1638,10 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    // FIXME
+    if (isRecording())
+        return;
+
</ins><span class="cx">     if (isLayerContext)
</span><span class="cx">         m_data-&gt;m_contextFlags |= IsLayerCGContext;
</span><span class="cx">     else
</span><span class="lines">@@ -1449,6 +1653,10 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    // FIXME
+    if (isRecording())
+        return false;
+
</ins><span class="cx">     return m_data-&gt;m_contextFlags &amp; IsLayerCGContext;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1457,6 +1665,10 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    // FIXME
+    if (isRecording())
+        return;
+
</ins><span class="cx">     if (isAccelerated)
</span><span class="cx">         m_data-&gt;m_contextFlags |= IsAcceleratedCGContext;
</span><span class="cx">     else
</span><span class="lines">@@ -1468,6 +1680,10 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    // FIXME
+    if (isRecording())
+        return false;
+
</ins><span class="cx">     return m_data-&gt;m_contextFlags &amp; IsAcceleratedCGContext;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1476,6 +1692,8 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ASSERT(!isRecording());
+
</ins><span class="cx">     CGContextRef context = platformContext();
</span><span class="cx">     switch (mode) {
</span><span class="cx">     case TextModeFill:
</span><span class="lines">@@ -1496,6 +1714,9 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    ASSERT(!isRecording());
+
</ins><span class="cx">     setCGStrokeColor(platformContext(), color);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1503,6 +1724,9 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    ASSERT(!isRecording());
+
</ins><span class="cx">     CGContextSetLineWidth(platformContext(), std::max(thickness, 0.f));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1510,6 +1734,9 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    ASSERT(!isRecording());
+
</ins><span class="cx">     setCGFillColor(platformContext(), color);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1517,6 +1744,9 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    ASSERT(!isRecording());
+
</ins><span class="cx">     CGContextSetShouldAntialias(platformContext(), enable);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1524,6 +1754,9 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    ASSERT(!isRecording());
+
</ins><span class="cx">     CGContextSetShouldSmoothFonts(platformContext(), enable);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1531,6 +1764,9 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    ASSERT(!isRecording());
+
</ins><span class="cx">     CGContextSetAlpha(platformContext(), alpha);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1539,6 +1775,8 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ASSERT(!isRecording());
+
</ins><span class="cx">     CGBlendMode target = kCGBlendModeNormal;
</span><span class="cx">     if (blendMode != BlendModeNormal) {
</span><span class="cx">         switch (blendMode) {
</span><span class="lines">@@ -1650,6 +1888,8 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ASSERT(!isRecording());
+
</ins><span class="cx">     // CoreGraphics expects the base CTM of a HiDPI context to have the scale factor applied to it.
</span><span class="cx">     // Failing to change the base level CTM will cause certain CG features, such as focus rings,
</span><span class="cx">     // to draw with a scale factor of 1 rather than the actual scale factor.
</span><span class="lines">@@ -1661,6 +1901,8 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ASSERT(!isRecording());
+
</ins><span class="cx">     // CGContextFillEllipseInRect only supports solid colors.
</span><span class="cx">     if (m_state.fillGradient || m_state.fillPattern) {
</span><span class="cx">         fillEllipseAsPath(ellipse);
</span><span class="lines">@@ -1676,6 +1918,8 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    ASSERT(!isRecording());
+
</ins><span class="cx">     // CGContextStrokeEllipseInRect only supports solid colors.
</span><span class="cx">     if (m_state.strokeGradient || m_state.strokePattern) {
</span><span class="cx">         strokeEllipseAsPath(ellipse);
</span></span></pre>
</div>
</div>

</body>
</html>