<!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>[167342] trunk</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/167342">167342</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-04-15 20:45:28 -0700 (Tue, 15 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[EFL] Fix problems with the pixel dump.
https://bugs.webkit.org/show_bug.cgi?id=131265

Patch by Hyowon Kim &lt;hw1008.kim@samsung.com&gt; on 2014-04-15
Reviewed by Gyuyoung Kim.

Painting and compositing paths of WebKit-EFL were totally modified from <a href="http://trac.webkit.org/projects/webkit/changeset/166768">r166768</a>.
However pixel dump codes still call deprecated functions like ewk_view_paint(),
which causes that nothing is drawn.

This patch adds new member functions to AcceleratedCompositingContext to support pixel dump.
One of new functions is AcceleratedCompositingContext::extractImageData(),
which replaces deprecated function calls. Besides the extractImageData() is invoked by
ewk_view_screenshot_contents_get() in order to take the visible content displayed on the EFL webview.

Source/WebCore:
* platform/graphics/cairo/CairoUtilities.cpp:
(WebCore::flipImageSurfaceVertically): Flip pixel data of given cairo_surface_t vertically up/down.
Whereas Cairo uses the top-left corner as being 0,0 of the coordinate system,
OpenGL uses the bottom-left corner being 0,0.
So we need to vertically flip resultant images taken by glReadPixels().
* platform/graphics/cairo/CairoUtilities.h:

Source/WebKit/efl:
* WebCoreSupport/AcceleratedCompositingContextEfl.cpp:
(WebCore::AcceleratedCompositingContext::AcceleratedCompositingContext):
Create TextureMapper with a proper backend.
(WebCore::AcceleratedCompositingContext::flushPendingLayerChanges):
Revise a null check for m_rootLayer.
(WebCore::AcceleratedCompositingContext::paintToGraphicsContext):
Remove a creation check for TextureMapperGL.
(WebCore::AcceleratedCompositingContext::paintToCurrentGLContext):
Ditto.
(WebCore::AcceleratedCompositingContext::extractImageData):
Extract image data from the view and copy it to given Evas_Object.
(WebCore::AcceleratedCompositingContext::getImageData):
Get image data from the view and return it as cairo_surface_t on software mode.
(WebCore::AcceleratedCompositingContext::getImageDataGL):
Get image data from the view and return it as cairo_surface_t on GL mode.
* WebCoreSupport/AcceleratedCompositingContextEfl.h:
* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
(DumpRenderTreeSupportEfl::forcePaint): Repaint the entire webview before pixel dump.
* WebCoreSupport/DumpRenderTreeSupportEfl.h:
* ewk/ewk_view.cpp:
(ewk_view_mark_for_sync): Remove an unnecessary line.
(ewk_view_force_paint): Call flushAndRenderLayers().
(ewk_view_screenshot_contents_get): Remove 'scale' parameter and replace ewk_view_paint()
with AcceleratedCompositingContext::extractImageData().
* ewk/ewk_view.h:
* ewk/ewk_view_private.h:
* tests/test_ewk_view.cpp:
(TEST_F):

Tools:
* DumpRenderTree/efl/PixelDumpSupportEfl.cpp:
(createBitmapContextFromWebView): Add to call DumpRenderTreeSupportEfl::forcePaint().</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscairoCairoUtilitiescpp">trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscairoCairoUtilitiesh">trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h</a></li>
<li><a href="#trunkSourceWebKiteflChangeLog">trunk/Source/WebKit/efl/ChangeLog</a></li>
<li><a href="#trunkSourceWebKiteflWebCoreSupportAcceleratedCompositingContextEflcpp">trunk/Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.cpp</a></li>
<li><a href="#trunkSourceWebKiteflWebCoreSupportAcceleratedCompositingContextEflh">trunk/Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.h</a></li>
<li><a href="#trunkSourceWebKiteflWebCoreSupportDumpRenderTreeSupportEflcpp">trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp</a></li>
<li><a href="#trunkSourceWebKiteflWebCoreSupportDumpRenderTreeSupportEflh">trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h</a></li>
<li><a href="#trunkSourceWebKiteflewkewk_viewcpp">trunk/Source/WebKit/efl/ewk/ewk_view.cpp</a></li>
<li><a href="#trunkSourceWebKiteflewkewk_viewh">trunk/Source/WebKit/efl/ewk/ewk_view.h</a></li>
<li><a href="#trunkSourceWebKiteflewkewk_view_privateh">trunk/Source/WebKit/efl/ewk/ewk_view_private.h</a></li>
<li><a href="#trunkSourceWebKiteflteststest_ewk_viewcpp">trunk/Source/WebKit/efl/tests/test_ewk_view.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeeflPixelDumpSupportEflcpp">trunk/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (167341 => 167342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-04-16 02:42:22 UTC (rev 167341)
+++ trunk/Source/WebCore/ChangeLog        2014-04-16 03:45:28 UTC (rev 167342)
</span><span class="lines">@@ -1,5 +1,28 @@
</span><span class="cx"> 2014-04-15  Hyowon Kim  &lt;hw1008.kim@samsung.com&gt;
</span><span class="cx"> 
</span><ins>+        [EFL] Fix problems with the pixel dump.
+        https://bugs.webkit.org/show_bug.cgi?id=131265
+
+        Reviewed by Gyuyoung Kim.
+
+        Painting and compositing paths of WebKit-EFL were totally modified from r166768.
+        However pixel dump codes still call deprecated functions like ewk_view_paint(),
+        which causes that nothing is drawn.
+
+        This patch adds new member functions to AcceleratedCompositingContext to support pixel dump.
+        One of new functions is AcceleratedCompositingContext::extractImageData(),
+        which replaces deprecated function calls. Besides the extractImageData() is invoked by
+        ewk_view_screenshot_contents_get() in order to take the visible content displayed on the EFL webview.
+
+        * platform/graphics/cairo/CairoUtilities.cpp:
+        (WebCore::flipImageSurfaceVertically): Flip pixel data of given cairo_surface_t vertically up/down.
+        Whereas Cairo uses the top-left corner as being 0,0 of the coordinate system,
+        OpenGL uses the bottom-left corner being 0,0.
+        So we need to vertically flip resultant images taken by glReadPixels().
+        * platform/graphics/cairo/CairoUtilities.h:
+
+2014-04-15  Hyowon Kim  &lt;hw1008.kim@samsung.com&gt;
+
</ins><span class="cx">         Make page overlay functionality working on coordinated graphics.
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=131425
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscairoCairoUtilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp (167341 => 167342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp        2014-04-16 02:42:22 UTC (rev 167341)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp        2014-04-16 03:45:28 UTC (rev 167342)
</span><span class="lines">@@ -259,4 +259,27 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void flipImageSurfaceVertically(cairo_surface_t* surface)
+{
+    ASSERT(cairo_surface_get_type(surface) == CAIRO_SURFACE_TYPE_IMAGE);
+
+    IntSize size = cairoSurfaceSize(surface);
+    ASSERT(!size.isEmpty());
+
+    int stride = cairo_image_surface_get_stride(surface);
+    int halfHeight = size.height() / 2;
+
+    uint8_t* source = static_cast&lt;uint8_t*&gt;(cairo_image_surface_get_data(surface));
+    std::unique_ptr&lt;uint8_t[]&gt; tmp = std::make_unique&lt;uint8_t[]&gt;(stride);
+
+    for (int i = 0; i &lt; halfHeight; ++i) {
+        uint8_t* top = source + (i * stride);
+        uint8_t* bottom = source + ((size.height()-i-1) * stride);
+
+        memcpy(tmp.get(), top, stride);
+        memcpy(top, bottom, stride);
+        memcpy(bottom, tmp.get(), stride);
+    }
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscairoCairoUtilitiesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h (167341 => 167342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h        2014-04-16 02:42:22 UTC (rev 167341)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h        2014-04-16 03:45:28 UTC (rev 167342)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx"> void copyRectFromOneSurfaceToAnother(cairo_surface_t* from, cairo_surface_t* to, const IntSize&amp; offset, const IntRect&amp;, const IntSize&amp; = IntSize(), cairo_operator_t = CAIRO_OPERATOR_OVER);
</span><span class="cx"> 
</span><span class="cx"> IntSize cairoSurfaceSize(cairo_surface_t*);
</span><ins>+void flipImageSurfaceVertically(cairo_surface_t*);
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKiteflChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/ChangeLog (167341 => 167342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/ChangeLog        2014-04-16 02:42:22 UTC (rev 167341)
+++ trunk/Source/WebKit/efl/ChangeLog        2014-04-16 03:45:28 UTC (rev 167342)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2014-04-15  Hyowon Kim  &lt;hw1008.kim@samsung.com&gt;
+
+        [EFL] Fix problems with the pixel dump.
+        https://bugs.webkit.org/show_bug.cgi?id=131265
+
+        Reviewed by Gyuyoung Kim.
+
+        Painting and compositing paths of WebKit-EFL were totally modified from r166768.
+        However pixel dump codes still call deprecated functions like ewk_view_paint(),
+        which causes that nothing is drawn.
+
+        This patch adds new member functions to AcceleratedCompositingContext to support pixel dump.
+        One of new functions is AcceleratedCompositingContext::extractImageData(),
+        which replaces deprecated function calls. Besides the extractImageData() is invoked by
+        ewk_view_screenshot_contents_get() in order to take the visible content displayed on the EFL webview.
+
+        * WebCoreSupport/AcceleratedCompositingContextEfl.cpp:
+        (WebCore::AcceleratedCompositingContext::AcceleratedCompositingContext):
+        Create TextureMapper with a proper backend.
+        (WebCore::AcceleratedCompositingContext::flushPendingLayerChanges):
+        Revise a null check for m_rootLayer.
+        (WebCore::AcceleratedCompositingContext::paintToGraphicsContext):
+        Remove a creation check for TextureMapperGL.
+        (WebCore::AcceleratedCompositingContext::paintToCurrentGLContext):
+        Ditto.
+        (WebCore::AcceleratedCompositingContext::extractImageData):
+        Extract image data from the view and copy it to given Evas_Object.
+        (WebCore::AcceleratedCompositingContext::getImageData):
+        Get image data from the view and return it as cairo_surface_t on software mode.
+        (WebCore::AcceleratedCompositingContext::getImageDataGL):
+        Get image data from the view and return it as cairo_surface_t on GL mode.
+        * WebCoreSupport/AcceleratedCompositingContextEfl.h:
+        * WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
+        (DumpRenderTreeSupportEfl::forcePaint): Repaint the entire webview before pixel dump.
+        * WebCoreSupport/DumpRenderTreeSupportEfl.h:
+        * ewk/ewk_view.cpp:
+        (ewk_view_mark_for_sync): Remove an unnecessary line.
+        (ewk_view_force_paint): Call flushAndRenderLayers().
+        (ewk_view_screenshot_contents_get): Remove 'scale' parameter and replace ewk_view_paint()
+        with AcceleratedCompositingContext::extractImageData().
+        * ewk/ewk_view.h:
+        * ewk/ewk_view_private.h:
+        * tests/test_ewk_view.cpp:
+        (TEST_F):
+
</ins><span class="cx"> 2014-04-12  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
</span><span class="cx"> 
</span><span class="cx">         [SOUP] Libsoup internal credential setting should be controlled by loader decision
</span></span></pre></div>
<a id="trunkSourceWebKiteflWebCoreSupportAcceleratedCompositingContextEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.cpp (167341 => 167342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.cpp        2014-04-16 02:42:22 UTC (rev 167341)
+++ trunk/Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.cpp        2014-04-16 03:45:28 UTC (rev 167342)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> #if USE(TEXTURE_MAPPER_GL)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;AcceleratedCompositingContextEfl.h&quot;
</span><ins>+#include &quot;CairoUtilities.h&quot;
</ins><span class="cx"> #include &quot;CairoUtilitiesEfl.h&quot;
</span><span class="cx"> #include &quot;GraphicsLayerTextureMapper.h&quot;
</span><span class="cx"> #include &quot;MainFrame.h&quot;
</span><span class="lines">@@ -53,8 +54,13 @@
</span><span class="cx">             m_evasGLContext = EvasGLContext::create(m_evasGL.get());
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!m_evasGLContext)
</del><ins>+    if (m_evasGLContext) {
+        m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode);
+        static_cast&lt;TextureMapperGL*&gt;(m_textureMapper.get())-&gt;setEnableEdgeDistanceAntialiasing(true);
+    } else {
+        m_textureMapper = TextureMapper::create(TextureMapper::SoftwareMode);
</ins><span class="cx">         m_isAccelerated = false;
</span><ins>+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> AcceleratedCompositingContext::~AcceleratedCompositingContext()
</span><span class="lines">@@ -122,18 +128,13 @@
</span><span class="cx"> 
</span><span class="cx"> bool AcceleratedCompositingContext::flushPendingLayerChanges()
</span><span class="cx"> {
</span><del>-    if (!m_rootLayer)
-        return false;
-
-    m_rootLayer-&gt;flushCompositingStateForThisLayerOnly();
</del><ins>+    if (m_rootLayer)
+        m_rootLayer-&gt;flushCompositingStateForThisLayerOnly();
</ins><span class="cx">     return EWKPrivate::corePage(m_view)-&gt;mainFrame().view()-&gt;flushCompositingStateIncludingSubframes();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AcceleratedCompositingContext::paintToGraphicsContext()
</span><span class="cx"> {
</span><del>-    if (!m_textureMapper)
-        m_textureMapper = TextureMapper::create(TextureMapper::SoftwareMode);
-
</del><span class="cx">     RefPtr&lt;cairo_surface_t&gt; surface = createSurfaceForImage(m_compositingObject);
</span><span class="cx">     if (!surface)
</span><span class="cx">         return;
</span><span class="lines">@@ -147,11 +148,6 @@
</span><span class="cx"> 
</span><span class="cx"> void AcceleratedCompositingContext::paintToCurrentGLContext()
</span><span class="cx"> {
</span><del>-    if (!m_textureMapper) {
-        m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode);
-        static_cast&lt;TextureMapperGL*&gt;(m_textureMapper.get())-&gt;setEnableEdgeDistanceAntialiasing(true);
-    }
-
</del><span class="cx">     if (!evas_gl_make_current(m_evasGL.get(), m_evasGLSurface-&gt;surface(), m_evasGLContext-&gt;context()))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -189,6 +185,52 @@
</span><span class="cx">         m_syncTimer.startOneShot(0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void AcceleratedCompositingContext::extractImageData(Evas_Object* buffer, const IntRect&amp; rect)
+{
+    ASSERT(buffer);
+
+    Evas_Coord width, height;
+    evas_object_image_size_get(buffer, &amp;width, &amp;height);
+
+    ASSERT(rect.width() == width);
+    ASSERT(rect.height() == height);
+
+    RefPtr&lt;cairo_surface_t&gt; imageData;
+    if (m_isAccelerated) {
+        imageData = getImageDataGL(rect);
+        flipImageSurfaceVertically(imageData.get());
+    } else
+        imageData = getImageData(rect);
+
+    evas_object_image_data_copy_set(buffer, static_cast&lt;void*&gt;(cairo_image_surface_get_data(imageData.get())));
+}
+
+PassRefPtr&lt;cairo_surface_t&gt; AcceleratedCompositingContext::getImageData(const IntRect&amp; rect)
+{
+    RefPtr&lt;cairo_surface_t&gt; source = createSurfaceForImage(m_compositingObject);
+    evas_object_image_data_set(m_compositingObject, static_cast&lt;void*&gt;(cairo_image_surface_get_data(source.get())));
+
+    if (m_viewSize == rect.size())
+        return source.release();
+
+    RefPtr&lt;cairo_surface_t&gt; destination = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, rect.width(), rect.height()));
+    copyRectFromOneSurfaceToAnother(source.get(), destination.get(), -IntSize(rect.x(), rect.y()), IntRect(IntPoint(), rect.size()), IntSize(), CAIRO_OPERATOR_SOURCE);
+    return destination.release();
+}
+
+PassRefPtr&lt;cairo_surface_t&gt; AcceleratedCompositingContext::getImageDataGL(const IntRect&amp; rect)
+{
+    if (!evas_gl_make_current(m_evasGL.get(), m_evasGLSurface-&gt;surface(), m_evasGLContext-&gt;context()))
+        return nullptr;
+
+    RefPtr&lt;cairo_surface_t&gt; source = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, rect.width(), rect.height()));
+    uint8_t* sourcePtr = static_cast&lt;uint8_t*&gt;(cairo_image_surface_get_data(source.get()));
+
+    GraphicsContext3D* context3D = static_cast&lt;TextureMapperGL*&gt;(m_textureMapper.get())-&gt;graphicsContext3D();
+    context3D-&gt;readPixels(rect.x(), rect.y(), rect.width(), rect.height(), GraphicsContext3D::BGRA, GraphicsContext3D::UNSIGNED_BYTE, sourcePtr);
+    return source.release();
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // USE(TEXTURE_MAPPER_GL)
</span></span></pre></div>
<a id="trunkSourceWebKiteflWebCoreSupportAcceleratedCompositingContextEflh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.h (167341 => 167342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.h        2014-04-16 02:42:22 UTC (rev 167341)
+++ trunk/Source/WebKit/efl/WebCoreSupport/AcceleratedCompositingContextEfl.h        2014-04-16 03:45:28 UTC (rev 167342)
</span><span class="lines">@@ -45,6 +45,8 @@
</span><span class="cx">     void resize(const IntSize&amp;);
</span><span class="cx">     void flushAndRenderLayers();
</span><span class="cx"> 
</span><ins>+    void extractImageData(Evas_Object*, const IntRect&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     void paintToGraphicsContext();
</span><span class="cx">     void paintToCurrentGLContext();
</span><span class="lines">@@ -53,6 +55,9 @@
</span><span class="cx">     bool flushPendingLayerChanges();
</span><span class="cx">     void syncLayers(Timer&lt;AcceleratedCompositingContext&gt;*);
</span><span class="cx"> 
</span><ins>+    PassRefPtr&lt;cairo_surface_t&gt; getImageData(const IntRect&amp;);
+    PassRefPtr&lt;cairo_surface_t&gt; getImageDataGL(const IntRect&amp;);
+
</ins><span class="cx">     Evas_Object* m_view;
</span><span class="cx">     Evas_Object* m_compositingObject;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKiteflWebCoreSupportDumpRenderTreeSupportEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp (167341 => 167342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp        2014-04-16 02:42:22 UTC (rev 167341)
+++ trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp        2014-04-16 03:45:28 UTC (rev 167342)
</span><span class="lines">@@ -349,6 +349,11 @@
</span><span class="cx">     ewk_frame_force_layout(ewkFrame);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void DumpRenderTreeSupportEfl::forcePaint(Evas_Object* ewkView)
+{
+    ewk_view_force_paint(ewkView);
+}
+
</ins><span class="cx"> void DumpRenderTreeSupportEfl::setTracksRepaints(Evas_Object* ewkFrame, bool enabled)
</span><span class="cx"> {
</span><span class="cx">     DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame);
</span></span></pre></div>
<a id="trunkSourceWebKiteflWebCoreSupportDumpRenderTreeSupportEflh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h (167341 => 167342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h        2014-04-16 02:42:22 UTC (rev 167341)
+++ trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h        2014-04-16 03:45:28 UTC (rev 167342)
</span><span class="lines">@@ -83,6 +83,7 @@
</span><span class="cx">     static void setWebAudioEnabled(Evas_Object* ewkView, bool);
</span><span class="cx"> 
</span><span class="cx">     static void forceLayout(Evas_Object* ewkFrame);
</span><ins>+    static void forcePaint(Evas_Object* ewkFrame);
</ins><span class="cx">     static void setTracksRepaints(Evas_Object* ewkFrame, bool enabled);
</span><span class="cx">     static void resetTrackedRepaints(Evas_Object* ewkFrame);
</span><span class="cx">     static bool isTrackingRepaints(const Evas_Object* ewkFrame);
</span></span></pre></div>
<a id="trunkSourceWebKiteflewkewk_viewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (167341 => 167342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp        2014-04-16 02:42:22 UTC (rev 167341)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp        2014-04-16 03:45:28 UTC (rev 167342)
</span><span class="lines">@@ -4412,13 +4412,20 @@
</span><span class="cx"> void ewk_view_mark_for_sync(Evas_Object* ewkView)
</span><span class="cx"> {
</span><span class="cx">     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
</span><del>-    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
</del><span class="cx"> 
</span><span class="cx">     // Mark the image as &quot;dirty&quot; meaning it needs an update next time evas renders.
</span><span class="cx">     // It will call the pixel get callback then.
</span><span class="cx">     evas_object_image_pixels_dirty_set(smartData-&gt;image, true);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ewk_view_force_paint(Evas_Object* ewkView)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+
+    priv-&gt;acceleratedCompositingContext-&gt;flushAndRenderLayers();
+}
+
</ins><span class="cx"> void ewk_view_cursor_set(Evas_Object* ewkView, const WebCore::Cursor&amp; cursor)
</span><span class="cx"> {
</span><span class="cx">     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
</span><span class="lines">@@ -4543,18 +4550,13 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* ewkView, const Eina_Rectangle* area, float scale)
</del><ins>+Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* ewkView, const Eina_Rectangle* area)
</ins><span class="cx"> {
</span><span class="cx">     if (!area || !area-&gt;w || !area-&gt;h) {
</span><span class="cx">         ERR(&quot;empty area is not allowed&quot;);
</span><span class="cx">         return 0;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (scale &lt; std::numeric_limits&lt;float&gt;::epsilon()) {
-        ERR(&quot;scale factor should be bigger than zero&quot;);
-        return 0;
-    }
-
</del><span class="cx">     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
</span><span class="cx">     EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
</span><span class="cx"> 
</span><span class="lines">@@ -4562,24 +4564,13 @@
</span><span class="cx">     EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
</span><span class="cx"> 
</span><span class="cx">     Evas_Object* screenshotImage = evas_object_image_add(canvas);
</span><del>-    int surfaceWidth = area-&gt;w * scale;
-    int surfaceHeight = area-&gt;h * scale;
-    evas_object_image_size_set(screenshotImage, surfaceWidth, surfaceHeight);
-    evas_object_image_fill_set(screenshotImage, 0, 0, surfaceWidth, surfaceHeight);
-    evas_object_resize(screenshotImage, surfaceWidth, surfaceHeight);
</del><ins>+    evas_object_image_size_set(screenshotImage, area-&gt;w, area-&gt;h);
+    evas_object_image_fill_set(screenshotImage, 0, 0, area-&gt;w, area-&gt;h);
+    evas_object_resize(screenshotImage, area-&gt;w, area-&gt;h);
</ins><span class="cx">     evas_object_image_colorspace_set(screenshotImage, EVAS_COLORSPACE_ARGB8888);
</span><del>-    evas_object_image_smooth_scale_set(screenshotImage, true);
</del><span class="cx"> 
</span><del>-    Ewk_Paint_Context* context = ewk_paint_context_from_image_new(screenshotImage);
-    ewk_paint_context_save(context);
-    ewk_paint_context_scale(context, scale, scale);
-    ewk_paint_context_translate(context, -1 * area-&gt;x, -1 * area-&gt;y);
</del><ins>+    priv-&gt;acceleratedCompositingContext-&gt;extractImageData(screenshotImage, WebCore::IntRect(*area));
</ins><span class="cx"> 
</span><del>-    ewk_view_paint(priv, context, area);
-
-    ewk_paint_context_restore(context);
-    ewk_paint_context_free(context);
-
</del><span class="cx">     return screenshotImage;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKiteflewkewk_viewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/ewk/ewk_view.h (167341 => 167342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/ewk/ewk_view.h        2014-04-16 02:42:22 UTC (rev 167341)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.h        2014-04-16 03:45:28 UTC (rev 167342)
</span><span class="lines">@@ -2486,17 +2486,16 @@
</span><span class="cx"> EAPI Ewk_Context_Menu *ewk_view_context_menu_get(const Evas_Object *o);
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Gets the image object of the specified area of the page
</del><ins>+ * Gets the image object of the specified area of the view.
</ins><span class="cx">  *
</span><span class="cx">  * The returned image object @b should be freed after use.
</span><span class="cx">  *
</span><span class="cx">  * @param o view object to be captured
</span><del>- * @param area The area of the page will be captured.
- * @param scale scale factor of captured object.
</del><ins>+ * @param area The area of the view will be captured.
</ins><span class="cx">  *
</span><span class="cx">  * @return newly allocated image object on sucess or @c NULL on failure.
</span><span class="cx">  */
</span><del>-EAPI Evas_Object *ewk_view_screenshot_contents_get(const Evas_Object *o, const Eina_Rectangle *area, float scale);
</del><ins>+EAPI Evas_Object *ewk_view_screenshot_contents_get(const Evas_Object *o, const Eina_Rectangle *area);
</ins><span class="cx"> 
</span><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKiteflewkewk_view_privateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/ewk/ewk_view_private.h (167341 => 167342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/ewk/ewk_view_private.h        2014-04-16 02:42:22 UTC (rev 167341)
+++ trunk/Source/WebKit/efl/ewk/ewk_view_private.h        2014-04-16 03:45:28 UTC (rev 167342)
</span><span class="lines">@@ -152,6 +152,8 @@
</span><span class="cx"> void ewk_view_root_graphics_layer_set(Evas_Object* ewkView, WebCore::GraphicsLayer* rootLayer);
</span><span class="cx"> void ewk_view_mark_for_sync(Evas_Object* ewkView);
</span><span class="cx"> 
</span><ins>+void ewk_view_force_paint(Evas_Object* ewkView);
+
</ins><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx"> void ewk_view_fullscreen_enter(const Evas_Object* ewkView);
</span><span class="cx"> void ewk_view_fullscreen_exit(const Evas_Object* ewkView);
</span></span></pre></div>
<a id="trunkSourceWebKiteflteststest_ewk_viewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/efl/tests/test_ewk_view.cpp (167341 => 167342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/efl/tests/test_ewk_view.cpp        2014-04-16 02:42:22 UTC (rev 167341)
+++ trunk/Source/WebKit/efl/tests/test_ewk_view.cpp        2014-04-16 03:45:28 UTC (rev 167342)
</span><span class="lines">@@ -132,26 +132,22 @@
</span><span class="cx"> 
</span><span class="cx">     Evas_Coord width, height;
</span><span class="cx"> 
</span><del>-    float scale = 2;
</del><span class="cx">     Eina_Rectangle area;
</span><span class="cx">     area.x = 10;
</span><span class="cx">     area.y = 10;
</span><span class="cx">     area.w = 20;
</span><span class="cx">     area.h = 30;
</span><del>-    Evas_Object* screenshot = ewk_view_screenshot_contents_get(webView(), &amp;area, scale);
</del><ins>+    Evas_Object* screenshot = ewk_view_screenshot_contents_get(webView(), &amp;area);
</ins><span class="cx">     evas_object_geometry_get(screenshot, 0, 0, &amp;width, &amp;height);
</span><del>-    ASSERT_EQ(area.w * scale, width);
-    ASSERT_EQ(area.h * scale, height);
</del><ins>+    ASSERT_EQ(area.w, width);
+    ASSERT_EQ(area.h, height);
</ins><span class="cx">     evas_object_del(screenshot);
</span><span class="cx"> 
</span><del>-    screenshot = ewk_view_screenshot_contents_get(webView(), &amp;area, 0);
</del><ins>+    screenshot = ewk_view_screenshot_contents_get(webView(), 0);
</ins><span class="cx">     ASSERT_FALSE(screenshot);
</span><span class="cx"> 
</span><del>-    screenshot = ewk_view_screenshot_contents_get(webView(), 0, 1);
-    ASSERT_FALSE(screenshot);
-
</del><span class="cx">     area.w = 0;
</span><span class="cx">     area.h = 0;
</span><del>-    screenshot = ewk_view_screenshot_contents_get(webView(), &amp;area, scale);
</del><ins>+    screenshot = ewk_view_screenshot_contents_get(webView(), &amp;area);
</ins><span class="cx">     ASSERT_FALSE(screenshot);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (167341 => 167342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-04-16 02:42:22 UTC (rev 167341)
+++ trunk/Tools/ChangeLog        2014-04-16 03:45:28 UTC (rev 167342)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-04-15  Hyowon Kim  &lt;hw1008.kim@samsung.com&gt;
+
+        [EFL] Fix problems with the pixel dump.
+        https://bugs.webkit.org/show_bug.cgi?id=131265
+
+        Reviewed by Gyuyoung Kim.
+
+        Painting and compositing paths of WebKit-EFL were totally modified from r166768.
+        However pixel dump codes still call deprecated functions like ewk_view_paint(),
+        which causes that nothing is drawn.
+
+        This patch adds new member functions to AcceleratedCompositingContext to support pixel dump.
+        One of new functions is AcceleratedCompositingContext::extractImageData(),
+        which replaces deprecated function calls. Besides the extractImageData() is invoked by
+        ewk_view_screenshot_contents_get() in order to take the visible content displayed on the EFL webview.
+
+        * DumpRenderTree/efl/PixelDumpSupportEfl.cpp:
+        (createBitmapContextFromWebView): Add to call DumpRenderTreeSupportEfl::forcePaint().
+
</ins><span class="cx"> 2014-04-15  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Update LLVM export scrpt to handle the build directory being different from the
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeeflPixelDumpSupportEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp (167341 => 167342)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp        2014-04-16 02:42:22 UTC (rev 167341)
+++ trunk/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp        2014-04-16 03:45:28 UTC (rev 167342)
</span><span class="lines">@@ -47,6 +47,8 @@
</span><span class="cx">     Ewk_View_Private_Data* privateData = static_cast&lt;Ewk_View_Private_Data*&gt;(smartData-&gt;_priv);
</span><span class="cx">     const Evas_Object* mainFrame = browser-&gt;mainFrame();
</span><span class="cx"> 
</span><ins>+    DumpRenderTreeSupportEfl::forcePaint(browser-&gt;mainView());
+
</ins><span class="cx">     int x, y, width, height;
</span><span class="cx">     evas_object_geometry_get(browser-&gt;mainFrame(), &amp;x, &amp;y, &amp;width, &amp;height);
</span><span class="cx">     const Eina_Rectangle rect = { x, y, width, height };
</span><span class="lines">@@ -54,7 +56,7 @@
</span><span class="cx">     RefPtr&lt;cairo_surface_t&gt; surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, rect.w, rect.h));
</span><span class="cx">     RefPtr&lt;cairo_t&gt; context = adoptRef(cairo_create(surface.get()));
</span><span class="cx"> 
</span><del>-    RefPtr&lt;Evas_Object&gt; screenshot = ewk_view_screenshot_contents_get(browser-&gt;mainView(), &amp;rect, 1);
</del><ins>+    RefPtr&lt;Evas_Object&gt; screenshot = ewk_view_screenshot_contents_get(browser-&gt;mainView(), &amp;rect);
</ins><span class="cx">     if (!screenshot)
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>