<!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>[194814] 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/194814">194814</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2016-01-08 17:41:27 -0800 (Fri, 08 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add DisplayList hooks into GraphicsContext
https://bugs.webkit.org/show_bug.cgi?id=152932

Reviewed by Zalan Bujtas.

Add the hooks into GraphicsContext that call into the DisplayListRecorder if there
is one.

Rename size() to something less ambiguous.

Out-of-line some DisplayList functions so that the header doesn't need to see
DisplayListItems.h.

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::save):
(WebCore::GraphicsContext::restore):
(WebCore::GraphicsContext::setStrokeThickness):
(WebCore::GraphicsContext::setStrokeStyle):
(WebCore::GraphicsContext::setStrokeColor):
(WebCore::GraphicsContext::setShadow):
(WebCore::GraphicsContext::setLegacyShadow):
(WebCore::GraphicsContext::clearShadow):
(WebCore::GraphicsContext::setFillColor):
(WebCore::GraphicsContext::setShadowsIgnoreTransforms):
(WebCore::GraphicsContext::setShouldAntialias):
(WebCore::GraphicsContext::setShouldSmoothFonts):
(WebCore::GraphicsContext::setShouldSubpixelQuantizeFonts):
(WebCore::GraphicsContext::setImageInterpolationQuality):
(WebCore::GraphicsContext::setAntialiasedFontDilationEnabled):
(WebCore::GraphicsContext::setStrokePattern):
(WebCore::GraphicsContext::setFillPattern):
(WebCore::GraphicsContext::setStrokeGradient):
(WebCore::GraphicsContext::setFillRule):
(WebCore::GraphicsContext::setFillGradient):
(WebCore::GraphicsContext::beginTransparencyLayer):
(WebCore::GraphicsContext::endTransparencyLayer):
(WebCore::GraphicsContext::drawGlyphs):
(WebCore::GraphicsContext::drawImage):
(WebCore::GraphicsContext::drawTiledImage):
(WebCore::GraphicsContext::setTextDrawingMode):
(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::fillRoundedRect):
(WebCore::GraphicsContext::setAlpha):
(WebCore::GraphicsContext::setCompositeOperation):
(WebCore::GraphicsContext::setDrawLuminanceMask):
(WebCore::GraphicsContext::applyDeviceScaleFactor):
(WebCore::GraphicsContext::applyState):
* platform/graphics/GraphicsContext.h:
(WebCore::GraphicsContext::setDisplayListRecorder):
(WebCore::GraphicsContext::isRecording):
(WebCore::GraphicsContext::setFillRule): Deleted.
(WebCore::GraphicsContext::setShadowsIgnoreTransforms): Deleted.
(WebCore::GraphicsContext::setShouldSubpixelQuantizeFonts): Deleted.
(WebCore::GraphicsContext::setDrawLuminanceMask): Deleted.
* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::clear):
(WebCore::DisplayList::DisplayList::removeItemsFromIndex):
* platform/graphics/displaylists/DisplayList.h:
(WebCore::DisplayList::DisplayList::itemCount):
(WebCore::DisplayList::DisplayList::clear): Deleted.
(WebCore::DisplayList::DisplayList::size): Deleted.
(WebCore::DisplayList::DisplayList::removeItemsFromIndex): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::save):
(WebCore::DisplayList::Recorder::restore):
* platform/graphics/displaylists/DisplayListRecorder.h:
(WebCore::DisplayList::Recorder::itemCount):
(WebCore::DisplayList::Recorder::size): Deleted.
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::Replayer::replay):</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="#trunkSourceWebCoreplatformgraphicsGraphicsContexth">trunk/Source/WebCore/platform/graphics/GraphicsContext.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListcpp">trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListh">trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListRecordercpp">trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListRecorderh">trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListReplayercpp">trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (194813 => 194814)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-01-09 01:36:41 UTC (rev 194813)
+++ trunk/Source/WebCore/ChangeLog        2016-01-09 01:41:27 UTC (rev 194814)
</span><span class="lines">@@ -1,3 +1,76 @@
</span><ins>+2016-01-08  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Add DisplayList hooks into GraphicsContext
+        https://bugs.webkit.org/show_bug.cgi?id=152932
+
+        Reviewed by Zalan Bujtas.
+
+        Add the hooks into GraphicsContext that call into the DisplayListRecorder if there
+        is one.
+        
+        Rename size() to something less ambiguous.
+        
+        Out-of-line some DisplayList functions so that the header doesn't need to see
+        DisplayListItems.h.
+
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::save):
+        (WebCore::GraphicsContext::restore):
+        (WebCore::GraphicsContext::setStrokeThickness):
+        (WebCore::GraphicsContext::setStrokeStyle):
+        (WebCore::GraphicsContext::setStrokeColor):
+        (WebCore::GraphicsContext::setShadow):
+        (WebCore::GraphicsContext::setLegacyShadow):
+        (WebCore::GraphicsContext::clearShadow):
+        (WebCore::GraphicsContext::setFillColor):
+        (WebCore::GraphicsContext::setShadowsIgnoreTransforms):
+        (WebCore::GraphicsContext::setShouldAntialias):
+        (WebCore::GraphicsContext::setShouldSmoothFonts):
+        (WebCore::GraphicsContext::setShouldSubpixelQuantizeFonts):
+        (WebCore::GraphicsContext::setImageInterpolationQuality):
+        (WebCore::GraphicsContext::setAntialiasedFontDilationEnabled):
+        (WebCore::GraphicsContext::setStrokePattern):
+        (WebCore::GraphicsContext::setFillPattern):
+        (WebCore::GraphicsContext::setStrokeGradient):
+        (WebCore::GraphicsContext::setFillRule):
+        (WebCore::GraphicsContext::setFillGradient):
+        (WebCore::GraphicsContext::beginTransparencyLayer):
+        (WebCore::GraphicsContext::endTransparencyLayer):
+        (WebCore::GraphicsContext::drawGlyphs):
+        (WebCore::GraphicsContext::drawImage):
+        (WebCore::GraphicsContext::drawTiledImage):
+        (WebCore::GraphicsContext::setTextDrawingMode):
+        (WebCore::GraphicsContext::fillRect):
+        (WebCore::GraphicsContext::fillRoundedRect):
+        (WebCore::GraphicsContext::setAlpha):
+        (WebCore::GraphicsContext::setCompositeOperation):
+        (WebCore::GraphicsContext::setDrawLuminanceMask):
+        (WebCore::GraphicsContext::applyDeviceScaleFactor):
+        (WebCore::GraphicsContext::applyState):
+        * platform/graphics/GraphicsContext.h:
+        (WebCore::GraphicsContext::setDisplayListRecorder):
+        (WebCore::GraphicsContext::isRecording):
+        (WebCore::GraphicsContext::setFillRule): Deleted.
+        (WebCore::GraphicsContext::setShadowsIgnoreTransforms): Deleted.
+        (WebCore::GraphicsContext::setShouldSubpixelQuantizeFonts): Deleted.
+        (WebCore::GraphicsContext::setDrawLuminanceMask): Deleted.
+        * platform/graphics/displaylists/DisplayList.cpp:
+        (WebCore::DisplayList::DisplayList::clear):
+        (WebCore::DisplayList::DisplayList::removeItemsFromIndex):
+        * platform/graphics/displaylists/DisplayList.h:
+        (WebCore::DisplayList::DisplayList::itemCount):
+        (WebCore::DisplayList::DisplayList::clear): Deleted.
+        (WebCore::DisplayList::DisplayList::size): Deleted.
+        (WebCore::DisplayList::DisplayList::removeItemsFromIndex): Deleted.
+        * platform/graphics/displaylists/DisplayListRecorder.cpp:
+        (WebCore::DisplayList::Recorder::save):
+        (WebCore::DisplayList::Recorder::restore):
+        * platform/graphics/displaylists/DisplayListRecorder.h:
+        (WebCore::DisplayList::Recorder::itemCount):
+        (WebCore::DisplayList::Recorder::size): Deleted.
+        * platform/graphics/displaylists/DisplayListReplayer.cpp:
+        (WebCore::DisplayList::Replayer::replay):
+
</ins><span class="cx"> 2016-01-08  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Modern IDB: imported/w3c/indexeddb/keyorder.htm times out.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (194813 => 194814)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp        2016-01-09 01:36:41 UTC (rev 194813)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp        2016-01-09 01:41:27 UTC (rev 194814)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;BidiResolver.h&quot;
</span><span class="cx"> #include &quot;BitmapImage.h&quot;
</span><ins>+#include &quot;DisplayListRecorder.h&quot;
</ins><span class="cx"> #include &quot;FloatRoundedRect.h&quot;
</span><span class="cx"> #include &quot;Gradient.h&quot;
</span><span class="cx"> #include &quot;ImageBuffer.h&quot;
</span><span class="lines">@@ -383,6 +384,11 @@
</span><span class="cx"> 
</span><span class="cx">     m_stack.append(m_state);
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;save();
+        return;
+    }
+
</ins><span class="cx">     savePlatformState();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -403,6 +409,11 @@
</span><span class="cx">     if (m_stack.isEmpty())
</span><span class="cx">         m_stack.clear();
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;restore();
+        return;
+    }
+
</ins><span class="cx">     restorePlatformState();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -429,12 +440,21 @@
</span><span class="cx"> void GraphicsContext::setStrokeThickness(float thickness)
</span><span class="cx"> {
</span><span class="cx">     m_state.strokeThickness = thickness;
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::StrokeThicknessChange);
+        return;
+    }
+
</ins><span class="cx">     setPlatformStrokeThickness(thickness);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GraphicsContext::setStrokeStyle(StrokeStyle style)
</span><span class="cx"> {
</span><span class="cx">     m_state.strokeStyle = style;
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::StrokeStyleChange);
+        return;
+    }
</ins><span class="cx">     setPlatformStrokeStyle(style);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -443,6 +463,10 @@
</span><span class="cx">     m_state.strokeColor = color;
</span><span class="cx">     m_state.strokeGradient = nullptr;
</span><span class="cx">     m_state.strokePattern = nullptr;
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::StrokeColorChange);
+        return;
+    }
</ins><span class="cx">     setPlatformStrokeColor(color);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -451,6 +475,13 @@
</span><span class="cx">     m_state.shadowOffset = offset;
</span><span class="cx">     m_state.shadowBlur = blur;
</span><span class="cx">     m_state.shadowColor = color;
</span><ins>+#if USE(CG)
+    m_state.shadowsUseLegacyRadius = false;
+#endif
+    if (isRecording()) {
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::ShadowChange);
+        return;
+    }
</ins><span class="cx">     setPlatformShadow(offset, blur, color);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -462,6 +493,10 @@
</span><span class="cx"> #if USE(CG)
</span><span class="cx">     m_state.shadowsUseLegacyRadius = true;
</span><span class="cx"> #endif
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::ShadowChange);
+        return;
+    }
</ins><span class="cx">     setPlatformShadow(offset, blur, color);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -470,6 +505,14 @@
</span><span class="cx">     m_state.shadowOffset = FloatSize();
</span><span class="cx">     m_state.shadowBlur = 0;
</span><span class="cx">     m_state.shadowColor = Color();
</span><ins>+#if USE(CG)
+    m_state.shadowsUseLegacyRadius = false;
+#endif
+
+    if (isRecording()) {
+        m_displayListRecorder-&gt;clearShadow();
+        return;
+    }
</ins><span class="cx">     clearPlatformShadow();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -505,21 +548,53 @@
</span><span class="cx">     m_state.fillColor = color;
</span><span class="cx">     m_state.fillGradient = nullptr;
</span><span class="cx">     m_state.fillPattern = nullptr;
</span><ins>+
+    if (isRecording()) {
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::FillColorChange);
+        return;
+    }
+
</ins><span class="cx">     setPlatformFillColor(color);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GraphicsContext::setShadowsIgnoreTransforms(bool shadowsIgnoreTransforms)
+{
+    m_state.shadowsIgnoreTransforms = shadowsIgnoreTransforms;
+    if (isRecording())
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::ShadowsIgnoreTransformsChange);
+}
+
</ins><span class="cx"> void GraphicsContext::setShouldAntialias(bool shouldAntialias)
</span><span class="cx"> {
</span><span class="cx">     m_state.shouldAntialias = shouldAntialias;
</span><ins>+
+    if (isRecording()) {
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::ShouldAntialiasChange);
+        return;
+    }
+
</ins><span class="cx">     setPlatformShouldAntialias(shouldAntialias);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GraphicsContext::setShouldSmoothFonts(bool shouldSmoothFonts)
</span><span class="cx"> {
</span><span class="cx">     m_state.shouldSmoothFonts = shouldSmoothFonts;
</span><ins>+    
+    if (isRecording()) {
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::ShouldSmoothFontsChange);
+        return;
+    }
+    
</ins><span class="cx">     setPlatformShouldSmoothFonts(shouldSmoothFonts);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GraphicsContext::setShouldSubpixelQuantizeFonts(bool shouldSubpixelQuantizeFonts)
+{
+    m_state.shouldSubpixelQuantizeFonts = shouldSubpixelQuantizeFonts;
+    if (isRecording())
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::ShouldSubpixelQuantizeFontsChange);
+}
+
</ins><span class="cx"> void GraphicsContext::setImageInterpolationQuality(InterpolationQuality imageInterpolationQuality)
</span><span class="cx"> {
</span><span class="cx">     m_state.imageInterpolationQuality = imageInterpolationQuality;
</span><span class="lines">@@ -527,46 +602,76 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::ImageInterpolationQualityChange);
+        return;
+    }
+
</ins><span class="cx">     setPlatformImageInterpolationQuality(imageInterpolationQuality);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GraphicsContext::setAntialiasedFontDilationEnabled(bool antialiasedFontDilationEnabled)
</span><span class="cx"> {
</span><span class="cx">     m_state.antialiasedFontDilationEnabled = antialiasedFontDilationEnabled;
</span><ins>+    if (isRecording())
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::AntialiasedFontDilationEnabledChange);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GraphicsContext::setStrokePattern(Ref&lt;Pattern&gt;&amp;&amp; pattern)
</span><span class="cx"> {
</span><span class="cx">     m_state.strokeGradient = nullptr;
</span><span class="cx">     m_state.strokePattern = WTFMove(pattern);
</span><ins>+    if (isRecording())
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::StrokePatternChange);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GraphicsContext::setFillPattern(Ref&lt;Pattern&gt;&amp;&amp; pattern)
</span><span class="cx"> {
</span><span class="cx">     m_state.fillGradient = nullptr;
</span><span class="cx">     m_state.fillPattern = WTFMove(pattern);
</span><ins>+    if (isRecording())
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::FillPatternChange);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GraphicsContext::setStrokeGradient(Ref&lt;Gradient&gt;&amp;&amp; gradient)
</span><span class="cx"> {
</span><span class="cx">     m_state.strokeGradient = WTFMove(gradient);
</span><span class="cx">     m_state.strokePattern = nullptr;
</span><ins>+    if (isRecording())
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::StrokeGradientChange);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GraphicsContext::setFillRule(WindRule fillRule)
+{
+    m_state.fillRule = fillRule;
+    if (isRecording())
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::FillRuleChange);
+}
+
</ins><span class="cx"> void GraphicsContext::setFillGradient(Ref&lt;Gradient&gt;&amp;&amp; gradient)
</span><span class="cx"> {
</span><span class="cx">     m_state.fillGradient = WTFMove(gradient);
</span><span class="cx">     m_state.fillPattern = nullptr;
</span><ins>+    if (isRecording())
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::FillGradientChange); // FIXME: also fill pattern?
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GraphicsContext::beginTransparencyLayer(float opacity)
</span><span class="cx"> {
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;beginTransparencyLayer(opacity);
+        return;
+    }
</ins><span class="cx">     beginPlatformTransparencyLayer(opacity);
</span><span class="cx">     ++m_transparencyCount;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void GraphicsContext::endTransparencyLayer()
</span><span class="cx"> {
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;endTransparencyLayer();
+        return;
+    }
</ins><span class="cx">     endPlatformTransparencyLayer();
</span><span class="cx">     ASSERT(m_transparencyCount &gt; 0);
</span><span class="cx">     --m_transparencyCount;
</span><span class="lines">@@ -585,6 +690,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawGlyphs(font, buffer, from, numGlyphs, point, fontCascade.fontDescription().fontSmoothing());
+        return;
+    }
+
</ins><span class="cx">     fontCascade.drawGlyphs(*this, font, buffer, from, numGlyphs, point);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -651,6 +761,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawImage(image, destination, source, imagePaintingOptions);
+        return;
+    }
+
</ins><span class="cx">     // FIXME (49002): Should be InterpolationLow
</span><span class="cx">     InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_useLowQualityScale ? InterpolationNone : imageInterpolationQuality());
</span><span class="cx">     image.draw(*this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_orientationDescription);
</span><span class="lines">@@ -661,6 +776,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawTiledImage(image, destination, source, tileSize, spacing, imagePaintingOptions);
+        return;
+    }
+
</ins><span class="cx">     InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_useLowQualityScale ? InterpolationLow : imageInterpolationQuality());
</span><span class="cx">     image.drawTiled(*this, destination, source, tileSize, spacing, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode);
</span><span class="cx"> }
</span><span class="lines">@@ -671,6 +791,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;drawTiledImage(image, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions);
+        return;
+    }
+
</ins><span class="cx">     if (hRule == Image::StretchTile &amp;&amp; vRule == Image::StretchTile) {
</span><span class="cx">         // Just do a scale.
</span><span class="cx">         drawImage(image, destination, source, imagePaintingOptions);
</span><span class="lines">@@ -766,6 +891,11 @@
</span><span class="cx">     m_state.textDrawingMode = mode;
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    if (isRecording()) {
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::TextDrawingModeChange);
+        return;
+    }
</ins><span class="cx">     setPlatformTextDrawingMode(mode);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -773,6 +903,12 @@
</span><span class="cx"> {
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><ins>+
+    if (isRecording()) {
+        m_displayListRecorder-&gt;fillRect(rect, gradient);
+        return;
+    }
+
</ins><span class="cx">     gradient.fill(this, rect);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -781,6 +917,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, op, blendMode);
+        return;
+    }
+
</ins><span class="cx">     CompositeOperator previousOperator = compositeOperation();
</span><span class="cx">     setCompositeOperation(op, blendMode);
</span><span class="cx">     fillRect(rect, color);
</span><span class="lines">@@ -792,6 +933,11 @@
</span><span class="cx">     if (paintingDisabled())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;fillRoundedRect(rect, color, blendMode);
+        return;
+    }
+
</ins><span class="cx">     if (rect.isRounded()) {
</span><span class="cx">         setCompositeOperation(compositeOperation(), blendMode);
</span><span class="cx">         platformFillRoundedRect(rect, color);
</span><span class="lines">@@ -830,6 +976,10 @@
</span><span class="cx"> void GraphicsContext::setAlpha(float alpha)
</span><span class="cx"> {
</span><span class="cx">     m_state.alpha = alpha;
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::AlphaChange);
+        return;
+    }
</ins><span class="cx">     setPlatformAlpha(alpha);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -837,9 +987,20 @@
</span><span class="cx"> {
</span><span class="cx">     m_state.compositeOperator = compositeOperation;
</span><span class="cx">     m_state.blendMode = blendMode;
</span><ins>+    if (isRecording()) {
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::CompositeOperationChange);
+        return;
+    }
</ins><span class="cx">     setPlatformCompositeOperation(compositeOperation, blendMode);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GraphicsContext::setDrawLuminanceMask(bool drawLuminanceMask)
+{
+    m_state.drawLuminanceMask = drawLuminanceMask;
+    if (isRecording())
+        m_displayListRecorder-&gt;updateState(m_state, GraphicsContextState::DrawLuminanceMaskChange);
+}
+
</ins><span class="cx"> #if !USE(CG)
</span><span class="cx"> // Implement this if you want to go push the drawing mode into your native context immediately.
</span><span class="cx"> void GraphicsContext::setPlatformTextDrawingMode(TextDrawingModeFlags)
</span><span class="lines">@@ -934,6 +1095,12 @@
</span><span class="cx"> void GraphicsContext::applyDeviceScaleFactor(float deviceScaleFactor)
</span><span class="cx"> {
</span><span class="cx">     scale(FloatSize(deviceScaleFactor, deviceScaleFactor));
</span><ins>+
+    if (isRecording()) {
+        m_displayListRecorder-&gt;applyDeviceScaleFactor(deviceScaleFactor);
+        return;
+    }
+
</ins><span class="cx">     platformApplyDeviceScaleFactor(deviceScaleFactor);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1013,4 +1180,18 @@
</span><span class="cx">     return FloatRect(origin, FloatSize(width, thickness));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GraphicsContext::applyState(const GraphicsContextState&amp; state)
+{
+    setPlatformShadow(state.shadowOffset, state.shadowBlur, state.shadowColor);
+    setPlatformStrokeThickness(state.strokeThickness);
+    setPlatformTextDrawingMode(state.textDrawingMode);
+    setPlatformStrokeColor(state.strokeColor);
+    setPlatformFillColor(state.fillColor);
+    setPlatformStrokeStyle(state.strokeStyle);
+    setPlatformAlpha(state.alpha);
+    setPlatformCompositeOperation(state.compositeOperator, state.blendMode);
+    setPlatformShouldAntialias(state.shouldAntialias);
+    setPlatformShouldSmoothFonts(state.shouldSmoothFonts);
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (194813 => 194814)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h        2016-01-09 01:36:41 UTC (rev 194813)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h        2016-01-09 01:41:27 UTC (rev 194814)
</span><span class="lines">@@ -110,6 +110,10 @@
</span><span class="cx">     InterpolationHigh
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+namespace DisplayList {
+class Recorder;
+}
+
</ins><span class="cx"> struct GraphicsContextState {
</span><span class="cx">     GraphicsContextState()
</span><span class="cx">         : shouldAntialias(true)
</span><span class="lines">@@ -246,6 +250,7 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><span class="cx">     WEBCORE_EXPORT GraphicsContext(PlatformGraphicsContext*);
</span><ins>+    GraphicsContext() = default;
</ins><span class="cx">     WEBCORE_EXPORT ~GraphicsContext();
</span><span class="cx">     
</span><span class="cx">     enum class NonPaintingReasons {
</span><span class="lines">@@ -256,9 +261,12 @@
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT PlatformGraphicsContext* platformContext() const;
</span><span class="cx"> 
</span><del>-    bool paintingDisabled() const { return !m_data; }
</del><ins>+    bool paintingDisabled() const { return !m_data &amp;&amp; !isRecording(); }
</ins><span class="cx">     bool updatingControlTints() const { return m_nonPaintingReasons == NonPaintingReasons::UpdatingControlTints; }
</span><span class="cx"> 
</span><ins>+    void setDisplayListRecorder(DisplayList::Recorder* recorder) { m_displayListRecorder = recorder; }
+    bool isRecording() const { return m_displayListRecorder; }
+
</ins><span class="cx">     void setStrokeThickness(float);
</span><span class="cx">     float strokeThickness() const { return m_state.strokeThickness; }
</span><span class="cx"> 
</span><span class="lines">@@ -274,7 +282,7 @@
</span><span class="cx">     void setStrokeGradient(Ref&lt;Gradient&gt;&amp;&amp;);
</span><span class="cx">     Gradient* strokeGradient() const { return m_state.strokeGradient.get(); }
</span><span class="cx"> 
</span><del>-    void setFillRule(WindRule fillRule) { m_state.fillRule = fillRule; }
</del><ins>+    void setFillRule(WindRule);
</ins><span class="cx">     WindRule fillRule() const { return m_state.fillRule; }
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void setFillColor(const Color&amp;);
</span><span class="lines">@@ -286,7 +294,7 @@
</span><span class="cx">     WEBCORE_EXPORT void setFillGradient(Ref&lt;Gradient&gt;&amp;&amp;);
</span><span class="cx">     Gradient* fillGradient() const { return m_state.fillGradient.get(); }
</span><span class="cx"> 
</span><del>-    void setShadowsIgnoreTransforms(bool shadowsIgnoreTransforms) { m_state.shadowsIgnoreTransforms = shadowsIgnoreTransforms; }
</del><ins>+    void setShadowsIgnoreTransforms(bool);
</ins><span class="cx">     bool shadowsIgnoreTransforms() const { return m_state.shadowsIgnoreTransforms; }
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void setShouldAntialias(bool);
</span><span class="lines">@@ -300,7 +308,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Normally CG enables subpixel-quantization because it improves the performance of aligning glyphs.
</span><span class="cx">     // In some cases we have to disable to to ensure a high-quality output of the glyphs.
</span><del>-    void setShouldSubpixelQuantizeFonts(bool shouldSubpixelQuantizeFonts) { m_state.shouldSubpixelQuantizeFonts = shouldSubpixelQuantizeFonts; }
</del><ins>+    void setShouldSubpixelQuantizeFonts(bool);
</ins><span class="cx">     bool shouldSubpixelQuantizeFonts() const { return m_state.shouldSubpixelQuantizeFonts; }
</span><span class="cx"> 
</span><span class="cx">     const GraphicsContextState&amp; state() const { return m_state; }
</span><span class="lines">@@ -393,6 +401,8 @@
</span><span class="cx">     void drawEmphasisMarks(const FontCascade&amp;, const TextRun&amp; , const AtomicString&amp; mark, const FloatPoint&amp;, int from = 0, int to = -1);
</span><span class="cx">     void drawBidiText(const FontCascade&amp;, const TextRun&amp;, const FloatPoint&amp;, FontCascade::CustomFontNotReadyAction = FontCascade::DoNotPaintIfFontNotReady);
</span><span class="cx"> 
</span><ins>+    void applyState(const GraphicsContextState&amp;);
+
</ins><span class="cx">     enum RoundingMode {
</span><span class="cx">         RoundAllSides,
</span><span class="cx">         RoundOriginAndDimensions
</span><span class="lines">@@ -452,7 +462,7 @@
</span><span class="cx">     CompositeOperator compositeOperation() const { return m_state.compositeOperator; }
</span><span class="cx">     BlendMode blendModeOperation() const { return m_state.blendMode; }
</span><span class="cx"> 
</span><del>-    void setDrawLuminanceMask(bool drawLuminanceMask) { m_state.drawLuminanceMask = drawLuminanceMask; }
</del><ins>+    void setDrawLuminanceMask(bool);
</ins><span class="cx">     bool drawLuminanceMask() const { return m_state.drawLuminanceMask; }
</span><span class="cx"> 
</span><span class="cx">     // This clip function is used only by &lt;canvas&gt; code. It allows
</span><span class="lines">@@ -602,6 +612,7 @@
</span><span class="cx">     FloatRect computeLineBoundsAndAntialiasingModeForText(const FloatPoint&amp;, float width, bool printing,  Color&amp;);
</span><span class="cx"> 
</span><span class="cx">     GraphicsContextPlatformPrivate* m_data { nullptr };
</span><ins>+    DisplayList::Recorder* m_displayListRecorder { nullptr };
</ins><span class="cx"> 
</span><span class="cx">     GraphicsContextState m_state;
</span><span class="cx">     Vector&lt;GraphicsContextState, 1&gt; m_stack;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp (194813 => 194814)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp        2016-01-09 01:36:41 UTC (rev 194813)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp        2016-01-09 01:41:27 UTC (rev 194814)
</span><span class="lines">@@ -48,6 +48,16 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+void DisplayList::clear()
+{
+    m_list.clear();
+}
+
+void DisplayList::removeItemsFromIndex(size_t index)
+{
+    m_list.resize(index);
+}
+
</ins><span class="cx"> void DisplayList::dump(TextStream&amp; ts) const
</span><span class="cx"> {
</span><span class="cx">     TextStream::GroupScope group(ts);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h (194813 => 194814)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h        2016-01-09 01:36:41 UTC (rev 194813)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h        2016-01-09 01:41:27 UTC (rev 194814)
</span><span class="lines">@@ -58,14 +58,10 @@
</span><span class="cx">         return m_list[index].get();
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    void clear() { m_list.clear(); }
-    size_t size() const { return m_list.size(); }
</del><ins>+    void clear();
+    void removeItemsFromIndex(size_t);
</ins><span class="cx"> 
</span><del>-    void removeItemsFromIndex(size_t index)
-    {
-        m_list.resize(index);
-    }
-
</del><ins>+    size_t itemCount() const { return m_list.size(); }
</ins><span class="cx">     size_t sizeInBytes() const;
</span><span class="cx"> 
</span><span class="cx"> #if !defined(NDEBUG) || !LOG_DISABLED
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListRecordercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp (194813 => 194814)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp        2016-01-09 01:36:41 UTC (rev 194813)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp        2016-01-09 01:41:27 UTC (rev 194814)
</span><span class="lines">@@ -143,7 +143,7 @@
</span><span class="cx"> void Recorder::save()
</span><span class="cx"> {
</span><span class="cx">     appendItem(Save::create());
</span><del>-    m_stateStack.append(m_stateStack.last().cloneForSave(m_displayList.size() - 1));
</del><ins>+    m_stateStack.append(m_stateStack.last().cloneForSave(m_displayList.itemCount() - 1));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Recorder::restore()
</span><span class="lines">@@ -168,7 +168,7 @@
</span><span class="cx">     
</span><span class="cx">     if (saveIndex) {
</span><span class="cx">         Save&amp; saveItem = downcast&lt;Save&gt;(m_displayList.itemAt(saveIndex));
</span><del>-        saveItem.setRestoreIndex(m_displayList.size() - 1);
</del><ins>+        saveItem.setRestoreIndex(m_displayList.itemCount() - 1);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListRecorderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h (194813 => 194814)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h        2016-01-09 01:36:41 UTC (rev 194813)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h        2016-01-09 01:41:27 UTC (rev 194814)
</span><span class="lines">@@ -120,7 +120,7 @@
</span><span class="cx">     
</span><span class="cx">     void applyDeviceScaleFactor(float);
</span><span class="cx"> 
</span><del>-    size_t size() const { return m_displayList.size(); }
</del><ins>+    size_t itemCount() const { return m_displayList.itemCount(); }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     Item&amp; appendItem(Ref&lt;Item&gt;&amp;&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListReplayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp (194813 => 194814)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp        2016-01-09 01:36:41 UTC (rev 194813)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp        2016-01-09 01:41:27 UTC (rev 194814)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx">     LOG_WITH_STREAM(DisplayLists, stream &lt;&lt; &quot;\nReplaying with clip &quot; &lt;&lt; initialClip);
</span><span class="cx">     UNUSED_PARAM(initialClip);
</span><span class="cx"> 
</span><del>-    size_t numItems = m_displayList.size();
</del><ins>+    size_t numItems = m_displayList.itemCount();
</ins><span class="cx">     for (size_t i = 0; i &lt; numItems; ++i) {
</span><span class="cx">         auto&amp; item = m_displayList.list()[i].get();
</span><span class="cx">         LOG_WITH_STREAM(DisplayLists, stream &lt;&lt; &quot;drawing  &quot; &lt;&lt; i &lt;&lt; &quot; &quot; &lt;&lt; item);
</span></span></pre>
</div>
</div>

</body>
</html>