<!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>[172869] trunk/Source</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/172869">172869</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-08-22 13:26:14 -0700 (Fri, 22 Aug 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Implement paint flashing in the WK1 InspectorOverlay page
https://bugs.webkit.org/show_bug.cgi?id=136138

Reviewed by Sam Weinig, Joseph Pecoraro.

Implement paint flashing for the WebKit1 InspectorOverlay via a second canvas in the overlay page.
We avoid allocating backing store for this canvas until we have paint rects.

Because this overlay page is weird and doesn't know how to paint itself, InspectorOverlay manages
an array of rects, and pushes them to the page when they change, before forcing a paint.

Because iOS doesn't use the InspectorOverlay page, stub out setShowPaintRects on its
WebKit WebInspectorClient, but don't yet implement paint flashing there.

Source/WebCore:

* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::InspectorOverlay):
(WebCore::InspectorOverlay::shouldShowOverlay):
(WebCore::InspectorOverlay::update):
(WebCore::buildObjectForRect):
(WebCore::InspectorOverlay::setShowingPaintRects):
(WebCore::InspectorOverlay::showPaintRect):
(WebCore::InspectorOverlay::updatePaintRectsTimerFired):
(WebCore::InspectorOverlay::drawPaintRects):
(WebCore::InspectorOverlay::forcePaint):
(WebCore::quadToPath): Deleted.
(WebCore::drawOutlinedQuad): Deleted.
(WebCore::InspectorOverlay::drawOutline): Deleted.
* inspector/InspectorOverlay.h:
* inspector/InspectorOverlayPage.html:
* inspector/InspectorOverlayPage.js:
(updatePaintRects):
(reset):
(_drawShapeHighlight):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::setShowPaintRects):
(WebCore::InspectorPageAgent::didPaint):

Source/WebKit/ios:

* WebCoreSupport/WebInspectorClientIOS.mm:
(WebInspectorClient::setShowPaintRects):
(WebInspectorClient::showPaintRect):

Source/WebKit/mac:

* WebCoreSupport/WebInspectorClient.h:
* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorClient::WebInspectorClient):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorOverlaycpp">trunk/Source/WebCore/inspector/InspectorOverlay.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorOverlayh">trunk/Source/WebCore/inspector/InspectorOverlay.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorOverlayPagehtml">trunk/Source/WebCore/inspector/InspectorOverlayPage.html</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorOverlayPagejs">trunk/Source/WebCore/inspector/InspectorOverlayPage.js</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorPageAgentcpp">trunk/Source/WebCore/inspector/InspectorPageAgent.cpp</a></li>
<li><a href="#trunkSourceWebKitiosChangeLog">trunk/Source/WebKit/ios/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitiosWebCoreSupportWebInspectorClientIOSmm">trunk/Source/WebKit/ios/WebCoreSupport/WebInspectorClientIOS.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebInspectorClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (172868 => 172869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-08-22 20:10:21 UTC (rev 172868)
+++ trunk/Source/WebCore/ChangeLog        2014-08-22 20:26:14 UTC (rev 172869)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2014-08-22  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Implement paint flashing in the WK1 InspectorOverlay page
+        https://bugs.webkit.org/show_bug.cgi?id=136138
+
+        Reviewed by Sam Weinig, Joseph Pecoraro.
+
+        Implement paint flashing for the WebKit1 InspectorOverlay via a second canvas in the overlay page.
+        We avoid allocating backing store for this canvas until we have paint rects.
+        
+        Because this overlay page is weird and doesn't know how to paint itself, InspectorOverlay manages
+        an array of rects, and pushes them to the page when they change, before forcing a paint.
+        
+        Because iOS doesn't use the InspectorOverlay page, stub out setShowPaintRects on its
+        WebKit WebInspectorClient, but don't yet implement paint flashing there.
+
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::InspectorOverlay):
+        (WebCore::InspectorOverlay::shouldShowOverlay):
+        (WebCore::InspectorOverlay::update):
+        (WebCore::buildObjectForRect):
+        (WebCore::InspectorOverlay::setShowingPaintRects):
+        (WebCore::InspectorOverlay::showPaintRect):
+        (WebCore::InspectorOverlay::updatePaintRectsTimerFired):
+        (WebCore::InspectorOverlay::drawPaintRects):
+        (WebCore::InspectorOverlay::forcePaint):
+        (WebCore::quadToPath): Deleted.
+        (WebCore::drawOutlinedQuad): Deleted.
+        (WebCore::InspectorOverlay::drawOutline): Deleted.
+        * inspector/InspectorOverlay.h:
+        * inspector/InspectorOverlayPage.html:
+        * inspector/InspectorOverlayPage.js:
+        (updatePaintRects):
+        (reset):
+        (_drawShapeHighlight):
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::setShowPaintRects):
+        (WebCore::InspectorPageAgent::didPaint):
+
</ins><span class="cx"> 2014-08-22  Eric Carlson  &lt;eric.carlson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Cleanup media code
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorOverlaycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (172868 => 172869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp        2014-08-22 20:10:21 UTC (rev 172868)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp        2014-08-22 20:26:14 UTC (rev 172869)
</span><span class="lines">@@ -63,41 +63,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static Path quadToPath(const FloatQuad&amp; quad)
-{
-    Path quadPath;
-    quadPath.moveTo(quad.p1());
-    quadPath.addLineTo(quad.p2());
-    quadPath.addLineTo(quad.p3());
-    quadPath.addLineTo(quad.p4());
-    quadPath.closeSubpath();
-    return quadPath;
-}
-
-static void drawOutlinedQuad(GraphicsContext* context, const FloatQuad&amp; quad, const Color&amp; fillColor, const Color&amp; outlineColor)
-{
-    static const int outlineThickness = 2;
-
-    Path quadPath = quadToPath(quad);
-
-    // Clip out the quad, then draw with a 2px stroke to get a pixel
-    // of outline (because inflating a quad is hard)
-    {
-        context-&gt;save();
-        context-&gt;clipOut(quadPath);
-
-        context-&gt;setStrokeThickness(outlineThickness);
-        context-&gt;setStrokeColor(outlineColor, ColorSpaceDeviceRGB);
-        context-&gt;strokePath(quadPath);
-
-        context-&gt;restore();
-    }
-
-    // Now do the fill
-    context-&gt;setFillColor(fillColor, ColorSpaceDeviceRGB);
-    context-&gt;fillPath(quadPath);
-}
-
</del><span class="cx"> static void contentsQuadToCoordinateSystem(const FrameView* mainView, const FrameView* view, FloatQuad&amp; quad, InspectorOverlay::CoordinateSystem coordinateSystem)
</span><span class="cx"> {
</span><span class="cx">     quad.setP1(view-&gt;contentsToRootView(roundedIntPoint(quad.p1())));
</span><span class="lines">@@ -238,7 +203,9 @@
</span><span class="cx"> InspectorOverlay::InspectorOverlay(Page&amp; page, InspectorClient* client)
</span><span class="cx">     : m_page(page)
</span><span class="cx">     , m_client(client)
</span><ins>+    , m_paintRectUpdateTimer(this, &amp;InspectorOverlay::updatePaintRectsTimerFired)
</ins><span class="cx">     , m_indicating(false)
</span><ins>+    , m_showingPaintRects(false)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -257,12 +224,6 @@
</span><span class="cx">     view-&gt;paint(&amp;context, IntRect(0, 0, view-&gt;width(), view-&gt;height()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InspectorOverlay::drawOutline(GraphicsContext* context, const LayoutRect&amp; rect, const Color&amp; color)
-{
-    FloatRect outlineRect = rect;
-    drawOutlinedQuad(context, outlineRect, Color(), color);
-}
-
</del><span class="cx"> void InspectorOverlay::getHighlight(Highlight* highlight, InspectorOverlay::CoordinateSystem coordinateSystem) const
</span><span class="cx"> {
</span><span class="cx">     if (!m_highlightNode &amp;&amp; !m_highlightQuad)
</span><span class="lines">@@ -329,7 +290,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool InspectorOverlay::shouldShowOverlay() const
</span><span class="cx"> {
</span><del>-    return m_highlightNode || m_highlightNode || m_indicating || !m_pausedInDebuggerMessage.isNull();
</del><ins>+    return m_highlightNode || m_highlightNode || m_indicating || m_showingPaintRects || !m_pausedInDebuggerMessage.isNull();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorOverlay::update()
</span><span class="lines">@@ -359,24 +320,34 @@
</span><span class="cx">     drawNodeHighlight();
</span><span class="cx">     drawQuadHighlight();
</span><span class="cx">     drawPausedInDebuggerMessage();
</span><ins>+    drawPaintRects();
</ins><span class="cx"> 
</span><span class="cx">     // Position DOM elements.
</span><span class="cx">     overlayPage()-&gt;mainFrame().document()-&gt;recalcStyle(Style::Force);
</span><span class="cx">     if (overlayView-&gt;needsLayout())
</span><span class="cx">         overlayView-&gt;layout();
</span><span class="cx"> 
</span><del>-    // Kick paint.
-    m_client-&gt;highlight();
</del><ins>+    forcePaint();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static PassRefPtr&lt;InspectorObject&gt; buildObjectForPoint(const FloatPoint&amp; point)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;InspectorObject&gt; object = InspectorObject::create();
</span><del>-    object-&gt;setNumber(&quot;x&quot;, point.x());
-    object-&gt;setNumber(&quot;y&quot;, point.y());
</del><ins>+    object-&gt;setNumber(ASCIILiteral(&quot;x&quot;), point.x());
+    object-&gt;setNumber(ASCIILiteral(&quot;y&quot;), point.y());
</ins><span class="cx">     return object.release();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static PassRefPtr&lt;InspectorObject&gt; buildObjectForRect(const FloatRect&amp; rect)
+{
+    RefPtr&lt;InspectorObject&gt; object = InspectorObject::create();
+    object-&gt;setNumber(ASCIILiteral(&quot;x&quot;), rect.x());
+    object-&gt;setNumber(ASCIILiteral(&quot;y&quot;), rect.y());
+    object-&gt;setNumber(ASCIILiteral(&quot;width&quot;), rect.width());
+    object-&gt;setNumber(ASCIILiteral(&quot;height&quot;), rect.height());
+    return object.release();
+}
+
</ins><span class="cx"> static PassRefPtr&lt;InspectorArray&gt; buildArrayForQuad(const FloatQuad&amp; quad)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;InspectorArray&gt; array = InspectorArray::create();
</span><span class="lines">@@ -499,9 +470,71 @@
</span><span class="cx">     return regionObject.release();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InspectorOverlay::setShowingPaintRects(bool showingPaintRects)
+{
+    if (m_showingPaintRects == showingPaintRects)
+        return;
+
+    m_showingPaintRects = showingPaintRects;
+    if (!m_showingPaintRects) {
+        m_paintRects.clear();
+        m_paintRectUpdateTimer.stop();
+        drawPaintRects();
+        forcePaint();
+    }
+}
+
+void InspectorOverlay::showPaintRect(const FloatRect&amp; rect)
+{
+    if (!m_showingPaintRects)
+        return;
+
+    IntRect rootRect = m_page.mainFrame().view()-&gt;contentsToRootView(enclosedIntRect(rect));
+
+    const constexpr std::chrono::milliseconds removeDelay = std::chrono::milliseconds(250);
+
+    std::chrono::steady_clock::time_point removeTime = std::chrono::steady_clock::now() + removeDelay;
+    m_paintRects.append(TimeRectPair(removeTime, rootRect));
+
+    if (!m_paintRectUpdateTimer.isActive()) {
+        const double paintRectsUpdateIntervalSeconds = 0.032;
+        m_paintRectUpdateTimer.startRepeating(paintRectsUpdateIntervalSeconds);
+    }
+
+    drawPaintRects();
+    forcePaint();
+}
+
+void InspectorOverlay::updatePaintRectsTimerFired(Timer&lt;InspectorOverlay&gt;&amp;)
+{
+    std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
+    bool rectsChanged = false;
+    while (!m_paintRects.isEmpty() &amp;&amp; m_paintRects.first().first &lt; now) {
+        m_paintRects.removeFirst();
+        rectsChanged = true;
+    }
+    
+    if (m_paintRects.isEmpty())
+        m_paintRectUpdateTimer.stop();
+
+    if (rectsChanged) {
+        drawPaintRects();
+        forcePaint();
+    }
+}
+
+void InspectorOverlay::drawPaintRects()
+{
+    RefPtr&lt;InspectorArray&gt; fragmentsArray = InspectorArray::create();
+    for (const auto&amp; pair : m_paintRects)
+        fragmentsArray-&gt;pushObject(buildObjectForRect(pair.second));
+
+    evaluateInOverlay(ASCIILiteral(&quot;updatePaintRects&quot;), fragmentsArray.release());
+}
+
</ins><span class="cx"> void InspectorOverlay::drawGutter()
</span><span class="cx"> {
</span><del>-    evaluateInOverlay(&quot;drawGutter&quot;);
</del><ins>+    evaluateInOverlay(ASCIILiteral(&quot;drawGutter&quot;));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static PassRefPtr&lt;InspectorArray&gt; buildObjectForRendererFragments(RenderObject* renderer, const HighlightConfig&amp; config)
</span><span class="lines">@@ -817,6 +850,12 @@
</span><span class="cx">     return m_overlayPage.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InspectorOverlay::forcePaint()
+{
+    // This overlay page is very weird and doesn't automatically paint. We have to force paints manually.
+    m_client-&gt;highlight();
+}
+
</ins><span class="cx"> void InspectorOverlay::reset(const IntSize&amp; viewportSize, const IntSize&amp; frameViewFullSize)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;InspectorObject&gt; resetData = InspectorObject::create();
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorOverlayh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorOverlay.h (172868 => 172869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorOverlay.h        2014-08-22 20:10:21 UTC (rev 172868)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.h        2014-08-22 20:26:14 UTC (rev 172869)
</span><span class="lines">@@ -32,6 +32,8 @@
</span><span class="cx"> #include &quot;Color.h&quot;
</span><span class="cx"> #include &quot;FloatQuad.h&quot;
</span><span class="cx"> #include &quot;LayoutRect.h&quot;
</span><ins>+#include &quot;Timer.h&quot;
+#include &lt;wtf/Deque.h&gt;
</ins><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="lines">@@ -110,7 +112,6 @@
</span><span class="cx"> 
</span><span class="cx">     void update();
</span><span class="cx">     void paint(GraphicsContext&amp;);
</span><del>-    void drawOutline(GraphicsContext*, const LayoutRect&amp;, const Color&amp;);
</del><span class="cx">     void getHighlight(Highlight*, CoordinateSystem) const;
</span><span class="cx"> 
</span><span class="cx">     void setPausedInDebuggerMessage(const String*);
</span><span class="lines">@@ -118,7 +119,10 @@
</span><span class="cx">     void hideHighlight();
</span><span class="cx">     void highlightNode(Node*, const HighlightConfig&amp;);
</span><span class="cx">     void highlightQuad(std::unique_ptr&lt;FloatQuad&gt;, const HighlightConfig&amp;);
</span><del>-
</del><ins>+    
+    void setShowingPaintRects(bool);
+    void showPaintRect(const FloatRect&amp;);
+    
</ins><span class="cx">     Node* highlightedNode() const;
</span><span class="cx"> 
</span><span class="cx">     void didSetSearchingForNode(bool enabled);
</span><span class="lines">@@ -134,7 +138,12 @@
</span><span class="cx">     void drawNodeHighlight();
</span><span class="cx">     void drawQuadHighlight();
</span><span class="cx">     void drawPausedInDebuggerMessage();
</span><ins>+    void drawPaintRects();
+    void updatePaintRectsTimerFired(Timer&lt;InspectorOverlay&gt;&amp;);
+
</ins><span class="cx">     Page* overlayPage();
</span><ins>+
+    void forcePaint();
</ins><span class="cx">     void reset(const IntSize&amp; viewportSize, const IntSize&amp; frameViewFullSize);
</span><span class="cx">     void evaluateInOverlay(const String&amp; method);
</span><span class="cx">     void evaluateInOverlay(const String&amp; method, const String&amp; argument);
</span><span class="lines">@@ -148,7 +157,12 @@
</span><span class="cx">     std::unique_ptr&lt;FloatQuad&gt; m_highlightQuad;
</span><span class="cx">     std::unique_ptr&lt;Page&gt; m_overlayPage;
</span><span class="cx">     HighlightConfig m_quadHighlightConfig;
</span><ins>+    
+    typedef std::pair&lt;std::chrono::steady_clock::time_point, FloatRect&gt; TimeRectPair;
+    Deque&lt;TimeRectPair&gt; m_paintRects;
+    Timer&lt;InspectorOverlay&gt; m_paintRectUpdateTimer;
</ins><span class="cx">     bool m_indicating;
</span><ins>+    bool m_showingPaintRects;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorOverlayPagehtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorOverlayPage.html (172868 => 172869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorOverlayPage.html        2014-08-22 20:10:21 UTC (rev 172868)
+++ trunk/Source/WebCore/inspector/InspectorOverlayPage.html        2014-08-22 20:26:14 UTC (rev 172869)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> &lt;body class=&quot;fill&quot;&gt;
</span><span class="cx"> &lt;div class=&quot;message-line&quot;&gt;&lt;span class=&quot;message-box&quot; id=&quot;paused-in-debugger&quot;&gt;&lt;/span&gt;&lt;/div&gt;
</span><span class="cx"> &lt;canvas id=&quot;canvas&quot; class=&quot;fill&quot;&gt;&lt;/canvas&gt;
</span><ins>+&lt;canvas id=&quot;paintrects-canvas&quot; class=&quot;fill&quot;&gt;&lt;/canvas&gt;
</ins><span class="cx"> &lt;div id=&quot;element-title-container&quot;&gt;&lt;/div&gt;
</span><span class="cx"> &lt;div id=&quot;right-gutter&quot;&gt;&lt;/div&gt;
</span><span class="cx"> &lt;div id=&quot;bottom-gutter&quot;&gt;&lt;/div&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorOverlayPagejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorOverlayPage.js (172868 => 172869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorOverlayPage.js        2014-08-22 20:10:21 UTC (rev 172868)
+++ trunk/Source/WebCore/inspector/InspectorOverlayPage.js        2014-08-22 20:26:14 UTC (rev 172869)
</span><span class="lines">@@ -22,6 +22,8 @@
</span><span class="cx"> const shapeHighlightColor = &quot;rgba(96, 82, 127, 0.8)&quot;;
</span><span class="cx"> const shapeMarginHighlightColor = &quot;rgba(96, 82, 127, 0.6)&quot;;
</span><span class="cx"> 
</span><ins>+const paintRectFillColor = &quot;rgba(255, 0, 0, 0.5)&quot;;
+
</ins><span class="cx"> function drawPausedInDebuggerMessage(message)
</span><span class="cx"> {
</span><span class="cx">     var pausedInDebugger = document.getElementById(&quot;paused-in-debugger&quot;);
</span><span class="lines">@@ -163,6 +165,24 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+var updatePaintRectsIntervalID;
+
+function updatePaintRects(paintRectList)
+{
+    var context = paintRectsCanvas.getContext(&quot;2d&quot;);
+    context.save();
+    context.scale(window.devicePixelRatio, window.devicePixelRatio);
+
+    context.clearRect(0, 0, paintRectsCanvas.width, paintRectsCanvas.height);
+
+    context.fillStyle = paintRectFillColor;
+
+    for (var rectObject of paintRectList)
+        context.fillRect(rectObject.x, rectObject.y, rectObject.width, rectObject.height);
+
+    context.restore();
+}
+
</ins><span class="cx"> function reset(resetData)
</span><span class="cx"> {
</span><span class="cx">     var deviceScaleFactor = resetData.deviceScaleFactor;
</span><span class="lines">@@ -170,6 +190,8 @@
</span><span class="cx">     window.frameViewFullSize = resetData.frameViewFullSize;
</span><span class="cx"> 
</span><span class="cx">     window.canvas = document.getElementById(&quot;canvas&quot;);
</span><ins>+    window.paintRectsCanvas = document.getElementById(&quot;paintrects-canvas&quot;);
+
</ins><span class="cx">     window.context = canvas.getContext(&quot;2d&quot;);
</span><span class="cx">     window.rightGutter = document.getElementById(&quot;right-gutter&quot;);
</span><span class="cx">     window.bottomGutter = document.getElementById(&quot;bottom-gutter&quot;);
</span><span class="lines">@@ -180,6 +202,12 @@
</span><span class="cx">     canvas.style.height = viewportSize.height + &quot;px&quot;;
</span><span class="cx">     context.scale(deviceScaleFactor, deviceScaleFactor);
</span><span class="cx"> 
</span><ins>+    // We avoid getting the the context for the paint rects canvas until we need to paint, to avoid backing store allocation.
+    paintRectsCanvas.width = deviceScaleFactor * viewportSize.width;
+    paintRectsCanvas.height = deviceScaleFactor * viewportSize.height;
+    paintRectsCanvas.style.width = viewportSize.width + &quot;px&quot;;
+    paintRectsCanvas.style.height = viewportSize.height + &quot;px&quot;;
+
</ins><span class="cx">     document.getElementById(&quot;paused-in-debugger&quot;).style.visibility = &quot;hidden&quot;;
</span><span class="cx">     document.getElementById(&quot;element-title-container&quot;).innerHTML = &quot;&quot;;
</span><span class="cx">     document.body.classList.remove(&quot;dimmed&quot;);
</span><span class="lines">@@ -383,7 +411,8 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function _drawShapeHighlight(shapeInfo) {
</del><ins>+function _drawShapeHighlight(shapeInfo)
+{
</ins><span class="cx">     if (shapeInfo.marginShape)
</span><span class="cx">         drawPath(context, shapeInfo.marginShape, shapeMarginHighlightColor);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorPageAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (172868 => 172869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp        2014-08-22 20:10:21 UTC (rev 172868)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp        2014-08-22 20:26:14 UTC (rev 172869)
</span><span class="lines">@@ -652,9 +652,11 @@
</span><span class="cx"> {
</span><span class="cx">     m_showPaintRects = show;
</span><span class="cx">     m_client-&gt;setShowPaintRects(show);
</span><ins>+    
+    if (m_client-&gt;overridesShowPaintRects())
+        return;
</ins><span class="cx"> 
</span><del>-    if (!show &amp;&amp; mainFrame() &amp;&amp; mainFrame()-&gt;view())
-        mainFrame()-&gt;view()-&gt;invalidate();
</del><ins>+    m_overlay-&gt;setShowingPaintRects(show);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::canShowDebugBorders(ErrorString*, bool* outParam)
</span><span class="lines">@@ -899,7 +901,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // FIXME: the overlay needs to accumulate paint rects and draw them itself.
</del><ins>+    m_overlay-&gt;showPaintRect(rect);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorPageAgent::didLayout()
</span></span></pre></div>
<a id="trunkSourceWebKitiosChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/ChangeLog (172868 => 172869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/ChangeLog        2014-08-22 20:10:21 UTC (rev 172868)
+++ trunk/Source/WebKit/ios/ChangeLog        2014-08-22 20:26:14 UTC (rev 172869)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-08-22  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Implement paint flashing in the WK1 InspectorOverlay page
+        https://bugs.webkit.org/show_bug.cgi?id=136138
+
+        Reviewed by Sam Weinig, Joseph Pecoraro.
+
+        Implement paint flashing for the WebKit1 InspectorOverlay via a second canvas in the overlay page.
+        We avoid allocating backing store for this canvas until we have paint rects.
+        
+        Because this overlay page is weird and doesn't know how to paint itself, InspectorOverlay manages
+        an array of rects, and pushes them to the page when they change, before forcing a paint.
+        
+        Because iOS doesn't use the InspectorOverlay page, stub out setShowPaintRects on its
+        WebKit WebInspectorClient, but don't yet implement paint flashing there.
+
+        * WebCoreSupport/WebInspectorClientIOS.mm:
+        (WebInspectorClient::setShowPaintRects):
+        (WebInspectorClient::showPaintRect):
+
</ins><span class="cx"> 2014-08-18  Andy Estes  &lt;aestes@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix the iOS build after  r172709.
</span></span></pre></div>
<a id="trunkSourceWebKitiosWebCoreSupportWebInspectorClientIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebInspectorClientIOS.mm (172868 => 172869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/WebCoreSupport/WebInspectorClientIOS.mm        2014-08-22 20:10:21 UTC (rev 172868)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebInspectorClientIOS.mm        2014-08-22 20:26:14 UTC (rev 172869)
</span><span class="lines">@@ -97,6 +97,16 @@
</span><span class="cx">     [m_webView setShowingInspectorIndication:NO];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebInspectorClient::setShowPaintRects(bool)
+{
+    // FIXME: implement.
+}
+
+void WebInspectorClient::showPaintRect(const FloatRect&amp;)
+{
+    // FIXME: need to do CALayer-based highlighting of paint rects.
+}
+
</ins><span class="cx"> void WebInspectorClient::didSetSearchingForNode(bool enabled)
</span><span class="cx"> {
</span><span class="cx">     WebInspector *inspector = [m_webView inspector];
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (172868 => 172869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-08-22 20:10:21 UTC (rev 172868)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-08-22 20:26:14 UTC (rev 172869)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-08-22  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Implement paint flashing in the WK1 InspectorOverlay page
+        https://bugs.webkit.org/show_bug.cgi?id=136138
+
+        Reviewed by Sam Weinig, Joseph Pecoraro.
+
+        Implement paint flashing for the WebKit1 InspectorOverlay via a second canvas in the overlay page.
+        We avoid allocating backing store for this canvas until we have paint rects.
+        
+        Because this overlay page is weird and doesn't know how to paint itself, InspectorOverlay manages
+        an array of rects, and pushes them to the page when they change, before forcing a paint.
+        
+        Because iOS doesn't use the InspectorOverlay page, stub out setShowPaintRects on its
+        WebKit WebInspectorClient, but don't yet implement paint flashing there.
+
+        * WebCoreSupport/WebInspectorClient.h:
+        * WebCoreSupport/WebInspectorClient.mm:
+        (WebInspectorClient::WebInspectorClient):
+
</ins><span class="cx"> 2014-08-20  Maciej Stachowiak  &lt;mjs@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Replace use of WKCopyCFLocalizationPreferredName with NSLocale public API
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebInspectorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h (172868 => 172869)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h        2014-08-22 20:10:21 UTC (rev 172868)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h        2014-08-22 20:26:14 UTC (rev 172869)
</span><span class="lines">@@ -76,6 +76,10 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     virtual void showInspectorIndication() override;
</span><span class="cx">     virtual void hideInspectorIndication() override;
</span><ins>+
+    virtual bool overridesShowPaintRects() const override { return true; }
+    virtual void setShowPaintRects(bool) override;
+    virtual void showPaintRect(const WebCore::FloatRect&amp;) override;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     virtual void didSetSearchingForNode(bool) override;
</span></span></pre>
</div>
</div>

</body>
</html>