<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Apr 25, 2013 at 1:58 PM, Emmanuel Rodriguez <span dir="ltr">&lt;<a href="mailto:emmanuel.rodriguez@gmail.com" target="_blank">emmanuel.rodriguez@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="im">On 25 April 2013 03:37, Jianhua Shao <span dir="ltr">&lt;<a href="mailto:alex.sjh@gmail.com" target="_blank">alex.sjh@gmail.com</a>&gt;</span> wrote:<br>
</div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><div class="im">On Thu, Apr 25, 2013 at 5:32 AM, Emmanuel Rodriguez <span dir="ltr">&lt;<a href="mailto:emmanuel.rodriguez@gmail.com" target="_blank">emmanuel.rodriguez@gmail.com</a>&gt;</span> wrote:<br>


</div><div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">
<div><span style="color:rgb(34,34,34)">Thanks for sharing your experience.  </span><br></div></div></div></div></blockquote></div></div></div><div class="im"><div>The version 1.6.3 does not meet my requirements. &quot;enable-accelerated-compositing&quot; is what I need in the newer version, from the dev document I found it is available from version 1.7.5.<br>


Seems I can give a try on version 1.7.x.<br></div></div></div></div></div></blockquote><div>I just ment to try it and see if the transparencies where still enabled in 1.6.3</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br>And have you read my another mail, <br><br>cairo_surface_t* surface = webkit_web_view_get_snapshot(view);<br><div dir="ltr">cairo_surface_write_to_png(surface, &quot;/home/meego/dump.png&quot;);<br>


<br>will result a transparent png file...<br>Maybe I need to do some configuration on cario/gtk, but I am new on this subject, anyone can give me some hint?</div></div></div></div></div></blockquote><div><br></div>
</div><div>By the looks of the code of 1.6.3 and 1.10.2 it seems that  webkit_web_view_get_snapshot() behaves like the old webkit_web_view_draw().<br></div><div><br></div><div>In 1.6.3 the draw operation is done with:</div>

<div><br></div><div><div>static void paintWebView(Frame* frame, gboolean transparent, GraphicsContext&amp; context, const IntRect&amp; clipRect, const Vector&lt;IntRect&gt;&amp; rects)</div><div>{</div><div>    bool coalesce = true;</div>

<div><br></div><div>    if (rects.size() &gt; 0)</div><div>        coalesce = shouldCoalesce(clipRect, rects);</div><div><br></div><div>    if (coalesce) {</div><div>        context.clip(clipRect);</div><div>        if (transparent)</div>

<div>            context.clearRect(clipRect);</div><div>        frame-&gt;view()-&gt;paint(&amp;context, clipRect);</div><div>    } else {</div><div>        for (size_t i = 0; i &lt; rects.size(); i++) {</div><div>            IntRect rect = rects[i];</div>

<div>            context.save();</div><div>            context.clip(rect);</div><div>            if (transparent)</div><div>                context.clearRect(rect);</div><div>            frame-&gt;view()-&gt;paint(&amp;context, rect);</div>

<div>            context.restore();</div><div>        }</div><div>    }</div><div><br></div><div>    context.save();</div><div>    context.clip(clipRect);</div><div>    frame-&gt;page()-&gt;inspectorController()-&gt;drawHighlight(context);</div>

<div>    context.restore();</div><div>}</div><div><br></div><div><br></div></div><div>In 1.10.2 webkit_web_view_get_snapshot is done with:</div><div><br></div><div><div>cairo_surface_t*</div><div>webkit_web_view_get_snapshot(WebKitWebView* webView)</div>

<div>{</div><div>    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);</div><div><br></div><div>    Frame* frame = core(webView)-&gt;mainFrame();</div><div>    if (!frame || !frame-&gt;contentRenderer() || !frame-&gt;view())</div>

<div>        return 0;</div><div><br></div><div>    frame-&gt;view()-&gt;updateLayoutAndStyleIfNeededRecursive();</div><div>    GtkAllocation allocation;</div><div>    gtk_widget_get_allocation(GTK_WIDGET(webView), &amp;allocation);</div>

<div>    cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, allocation.width, allocation.height);</div><div>    RefPtr&lt;cairo_t&gt; cr = adoptRef(cairo_create(surface));</div><div>    GraphicsContext gc(cr.get());</div>

<div><br></div><div>    IntRect rect = allocation;</div><div>    gc.applyDeviceScaleFactor(frame-&gt;page()-&gt;deviceScaleFactor());</div><div>    gc.save();</div><div>    gc.clip(rect);</div><div>    if (webView-&gt;priv-&gt;transparent)</div>

<div>        gc.clearRect(rect);</div><div>    frame-&gt;view()-&gt;paint(&amp;gc, rect);</div><div>    gc.restore();</div><div><br></div><div>    return surface;</div><div>}</div><div><br></div></div><div><br></div>
<div>Both functions have the same drawing logic:</div><div><br></div><div><div>        context.clip(clipRect);</div><div>        if (transparent)</div><div>            context.clearRect(clipRect);</div><div>
        frame-&gt;view()-&gt;paint(&amp;context, clipRect);</div><div>        context.restore();<br></div></div><div><br></div><div>Wit the exception that webkit_web_view_get_snapshot() forces the drawing into an image surface except of accepting a cairo context.</div>
<span class=""><font color="#888888">
<div><br></div></font></span></div></div></div></blockquote><div>Yeah, I have modified &quot;webkit_web_view_expose_event&quot; (the webkit_web_view_draw thing for gtk2), and I have made it transparent now.<br><br>Then I tried setting &#39;enable-accelerated-compositing&#39; flag. the result page I got is not correct. The appearance is a little wired I think.<br>
Firstly, a correct page shows up, then immediately after that (I mean, maybe 0.1 second after that), the page turns gray in most part, and stay at gray.<br><br>The issue exists even if I did not modify  &quot;webkit_web_view_expose_event&quot;.<br>
<br>Now I am trying to figure out whether something wrong with &quot;WEBKIT_WEB_VIEW(widget)-&gt;priv-&gt;backingStore-&gt;cairoSurface()&quot;.<br><br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><font color="#888888"><div></div><div>-- <br></div></font></span></div><span class=""><font color="#888888">Emmanuel Rodriguez
</font></span></div></div>
</blockquote></div><br></div></div>