<!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>[190235] 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/190235">190235</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2015-09-24 20:41:35 -0700 (Thu, 24 Sep 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Win] Support composited content in WebView render-to-context methods
https://bugs.webkit.org/show_bug.cgi?id=149516
<rdar://problem/22635080>
Reviewed by Simon Fraser.
Source/WebCore:
Extend the CACFLayerTreeHost implementation to render into a passed
device context when requested. When no context is provided (the default
case) paint as normal.
Will be tested by existing compositing tests in a future bug. DumpRenderTree
has to be extended to do this painting properly.
* platform/graphics/ca/win/CACFLayerTreeHost.cpp:
(WebCore::CACFLayerTreeHost::paint): Accept an optional HDC argument, and
pass it to the render method.
* platform/graphics/ca/win/CACFLayerTreeHost.h:
* platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp: Add missing SOFT_LINK
command for the WKCACFViewDrawIntoDC.
(WebCore::WKCACFViewLayerTreeHost::paint): Accept optional HDC argument and
pass it to the parent class.
(WebCore::WKCACFViewLayerTreeHost::render): Accept new optional HDC argument.
If provided, call WKCACFViewDrawIntoDC. Otherwise, call WKCACFVIewDraw.
(WebCore::WKCACFViewLayerTreeHost::setShouldInvertColors):
* platform/graphics/ca/win/WKCACFViewLayerTreeHost.h:
Source/WebKit/win:
* WebView.cpp:
(WebView::paint): Call the new 'paintCompositedContentToHDC' method. If
it handles the pain, return.
(WebView::paintCompositedContentToHDC): New method to share code with other
paint methods.
(WebView::paintDocumentRectToContext): Call new 'paintCompositedContentToHDC'
to handle any composited layers. Otherwise, use slow drawing path.
(WebView::paintScrollViewRectToContextAtPoint): Ditto.
* WebView.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscawinCACFLayerTreeHostcpp">trunk/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscawinCACFLayerTreeHosth">trunk/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscawinWKCACFViewLayerTreeHostcpp">trunk/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscawinWKCACFViewLayerTreeHosth">trunk/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h</a></li>
<li><a href="#trunkSourceWebKitwinChangeLog">trunk/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinWebViewcpp">trunk/Source/WebKit/win/WebView.cpp</a></li>
<li><a href="#trunkSourceWebKitwinWebViewh">trunk/Source/WebKit/win/WebView.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (190234 => 190235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-09-25 02:56:47 UTC (rev 190234)
+++ trunk/Source/WebCore/ChangeLog        2015-09-25 03:41:35 UTC (rev 190235)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2015-09-24 Brent Fulgham <bfulgham@apple.com>
+
+ [Win] Support composited content in WebView render-to-context methods
+ https://bugs.webkit.org/show_bug.cgi?id=149516
+ <rdar://problem/22635080>
+
+ Reviewed by Simon Fraser.
+
+ Extend the CACFLayerTreeHost implementation to render into a passed
+ device context when requested. When no context is provided (the default
+ case) paint as normal.
+
+ Will be tested by existing compositing tests in a future bug. DumpRenderTree
+ has to be extended to do this painting properly.
+
+ * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
+ (WebCore::CACFLayerTreeHost::paint): Accept an optional HDC argument, and
+ pass it to the render method.
+ * platform/graphics/ca/win/CACFLayerTreeHost.h:
+ * platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp: Add missing SOFT_LINK
+ command for the WKCACFViewDrawIntoDC.
+ (WebCore::WKCACFViewLayerTreeHost::paint): Accept optional HDC argument and
+ pass it to the parent class.
+ (WebCore::WKCACFViewLayerTreeHost::render): Accept new optional HDC argument.
+ If provided, call WKCACFViewDrawIntoDC. Otherwise, call WKCACFVIewDraw.
+ (WebCore::WKCACFViewLayerTreeHost::setShouldInvertColors):
+ * platform/graphics/ca/win/WKCACFViewLayerTreeHost.h:
+
</ins><span class="cx"> 2015-09-24 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Drop [NotDeletable] from QuickTimePluginReplacement.postEvent()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscawinCACFLayerTreeHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp (190234 => 190235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp        2015-09-25 02:56:47 UTC (rev 190234)
+++ trunk/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp        2015-09-25 03:41:35 UTC (rev 190235)
</span><span class="lines">@@ -261,11 +261,11 @@
</span><span class="cx"> outRects[i] = winRectToCGRect(*rect, clientRect);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void CACFLayerTreeHost::paint()
</del><ins>+void CACFLayerTreeHost::paint(HDC dc)
</ins><span class="cx"> {
</span><span class="cx"> Vector<CGRect> dirtyRects;
</span><span class="cx"> getDirtyRects(m_window, dirtyRects);
</span><del>- render(dirtyRects);
</del><ins>+ render(dirtyRects, dc);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void CACFLayerTreeHost::flushPendingGraphicsLayerChangesSoon()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscawinCACFLayerTreeHosth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h (190234 => 190235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h        2015-09-25 02:56:47 UTC (rev 190234)
+++ trunk/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h        2015-09-25 03:41:35 UTC (rev 190235)
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx"> void setRootChildLayer(PlatformCALayer*);
</span><span class="cx"> void setWindow(HWND);
</span><span class="cx"> void setPage(Page*);
</span><del>- virtual void paint();
</del><ins>+ virtual void paint(HDC = nullptr);
</ins><span class="cx"> virtual void resize() = 0;
</span><span class="cx"> void flushPendingGraphicsLayerChangesSoon();
</span><span class="cx"> virtual void setShouldInvertColors(bool);
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx">
</span><span class="cx"> virtual void flushContext() = 0;
</span><span class="cx"> virtual CFTimeInterval lastCommitTime() const = 0;
</span><del>- virtual void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>()) = 0;
</del><ins>+ virtual void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>(), HDC dc = nullptr) = 0;
</ins><span class="cx"> virtual void initializeContext(void* userData, PlatformCALayer*) = 0;
</span><span class="cx">
</span><span class="cx"> CACFLayerTreeHostClient* m_client { nullptr };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscawinWKCACFViewLayerTreeHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp (190234 => 190235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp        2015-09-25 02:56:47 UTC (rev 190234)
+++ trunk/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp        2015-09-25 03:41:35 UTC (rev 190235)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx"> SOFT_LINK(WebKitQuartzCoreAdditions, WKCACFViewUpdate, void, __cdecl, (WKCACFViewRef view, HWND window, const CGRect* bounds), (view, window, bounds))
</span><span class="cx"> SOFT_LINK(WebKitQuartzCoreAdditions, WKCACFViewCanDraw, bool, __cdecl, (WKCACFViewRef view), (view))
</span><span class="cx"> SOFT_LINK(WebKitQuartzCoreAdditions, WKCACFViewDraw, void, __cdecl, (WKCACFViewRef view), (view))
</span><ins>+SOFT_LINK(WebKitQuartzCoreAdditions, WKCACFViewDrawIntoDC, void, __cdecl, (WKCACFViewRef view, HDC dc), (view, dc))
</ins><span class="cx"> SOFT_LINK(WebKitQuartzCoreAdditions, WKCACFViewFlushContext, void, __cdecl, (WKCACFViewRef view), (view))
</span><span class="cx"> SOFT_LINK(WebKitQuartzCoreAdditions, WKCACFViewInvalidateRects, void, __cdecl, (WKCACFViewRef view, const CGRect rects[], size_t count), (view, rects, count))
</span><span class="cx"> typedef void (*WKCACFViewContextDidChangeCallback)(WKCACFViewRef view, void* info);
</span><span class="lines">@@ -156,16 +157,19 @@
</span><span class="cx"> WKCACFViewFlushContext(m_view.get());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WKCACFViewLayerTreeHost::paint()
</del><ins>+void WKCACFViewLayerTreeHost::paint(HDC dc)
</ins><span class="cx"> {
</span><span class="cx"> updateViewIfNeeded();
</span><del>- CACFLayerTreeHost::paint();
</del><ins>+ CACFLayerTreeHost::paint(dc);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WKCACFViewLayerTreeHost::render(const Vector<CGRect>& dirtyRects)
</del><ins>+void WKCACFViewLayerTreeHost::render(const Vector<CGRect>& dirtyRects, HDC dc)
</ins><span class="cx"> {
</span><span class="cx"> WKCACFViewInvalidateRects(m_view.get(), dirtyRects.data(), dirtyRects.size());
</span><del>- WKCACFViewDraw(m_view.get());
</del><ins>+ if (dc)
+ WKCACFViewDrawIntoDC(m_view.get(), dc);
+ else
+ WKCACFViewDraw(m_view.get());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WKCACFViewLayerTreeHost::setShouldInvertColors(bool shouldInvertColors)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscawinWKCACFViewLayerTreeHosth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h (190234 => 190235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h        2015-09-25 02:56:47 UTC (rev 190234)
+++ trunk/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h        2015-09-25 03:41:35 UTC (rev 190235)
</span><span class="lines">@@ -49,8 +49,8 @@
</span><span class="cx"> virtual void destroyRenderer();
</span><span class="cx"> virtual void flushContext();
</span><span class="cx"> virtual void contextDidChange();
</span><del>- virtual void paint();
- virtual void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>());
</del><ins>+ void paint(HDC = nullptr) override;
+ void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>(), HDC dc = nullptr) override;
</ins><span class="cx"> virtual CFTimeInterval lastCommitTime() const;
</span><span class="cx"> virtual void setShouldInvertColors(bool);
</span><span class="cx"> #if USE(AVFOUNDATION)
</span></span></pre></div>
<a id="trunkSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/ChangeLog (190234 => 190235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/ChangeLog        2015-09-25 02:56:47 UTC (rev 190234)
+++ trunk/Source/WebKit/win/ChangeLog        2015-09-25 03:41:35 UTC (rev 190235)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-09-24 Brent Fulgham <bfulgham@apple.com>
+
+ [Win] Support composited content in WebView render-to-context methods
+ https://bugs.webkit.org/show_bug.cgi?id=149516
+ <rdar://problem/22635080>
+
+ Reviewed by Simon Fraser.
+
+ * WebView.cpp:
+ (WebView::paint): Call the new 'paintCompositedContentToHDC' method. If
+ it handles the pain, return.
+ (WebView::paintCompositedContentToHDC): New method to share code with other
+ paint methods.
+ (WebView::paintDocumentRectToContext): Call new 'paintCompositedContentToHDC'
+ to handle any composited layers. Otherwise, use slow drawing path.
+ (WebView::paintScrollViewRectToContextAtPoint): Ditto.
+ * WebView.h:
+
</ins><span class="cx"> 2015-09-24 Per Arne Vollan <peavo@outlook.com>
</span><span class="cx">
</span><span class="cx"> [WinCairo] NULL pointer crash when trying to use tiled backing for frame view.
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebView.cpp (190234 => 190235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebView.cpp        2015-09-25 02:56:47 UTC (rev 190234)
+++ trunk/Source/WebKit/win/WebView.cpp        2015-09-25 03:41:35 UTC (rev 190235)
</span><span class="lines">@@ -1119,21 +1119,9 @@
</span><span class="cx"> {
</span><span class="cx"> LOCAL_GDI_COUNTER(0, __FUNCTION__);
</span><span class="cx">
</span><del>- if (isAcceleratedCompositing() && !usesLayeredWindow()) {
-#if USE(CA)
- m_layerTreeHost->flushPendingLayerChangesNow();
-#elif USE(TEXTURE_MAPPER_GL)
- m_acceleratedCompositingContext->flushAndRenderLayers();
-#endif
- // Flushing might have taken us out of compositing mode.
- if (isAcceleratedCompositing()) {
-#if USE(CA)
- // FIXME: We need to paint into dc (if provided). <http://webkit.org/b/52578>
- m_layerTreeHost->paint();
-#endif
- ::ValidateRect(m_viewWindow, 0);
- return;
- }
</del><ins>+ if (paintCompositedContentToHDC(dc)) {
+ ::ValidateRect(m_viewWindow, nullptr);
+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Frame* coreFrame = core(m_mainFrame);
</span><span class="lines">@@ -6143,6 +6131,28 @@
</span><span class="cx"> return S_OK;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool WebView::paintCompositedContentToHDC(HDC deviceContext)
+{
+ if (!isAcceleratedCompositing() || usesLayeredWindow())
+ return false;
+
+#if USE(CA)
+ m_layerTreeHost->flushPendingLayerChangesNow();
+#elif USE(TEXTURE_MAPPER_GL)
+ m_acceleratedCompositingContext->flushAndRenderLayers();
+#endif
+
+ // Flushing might have taken us out of compositing mode.
+ if (!isAcceleratedCompositing())
+ return false;
+
+#if USE(CA)
+ m_layerTreeHost->paint(deviceContext);
+#endif
+
+ return true;
+}
+
</ins><span class="cx"> HRESULT WebView::paintDocumentRectToContext(RECT rect, _In_ HDC deviceContext)
</span><span class="cx"> {
</span><span class="cx"> if (!deviceContext)
</span><span class="lines">@@ -6151,6 +6161,9 @@
</span><span class="cx"> if (!m_mainFrame)
</span><span class="cx"> return E_UNEXPECTED;
</span><span class="cx">
</span><ins>+ if (paintCompositedContentToHDC(deviceContext))
+ return S_OK;
+
</ins><span class="cx"> return m_mainFrame->paintDocumentRectToContext(rect, deviceContext);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -6162,6 +6175,9 @@
</span><span class="cx"> if (!m_mainFrame)
</span><span class="cx"> return E_UNEXPECTED;
</span><span class="cx">
</span><ins>+ if (paintCompositedContentToHDC(deviceContext))
+ return S_OK;
+
</ins><span class="cx"> return m_mainFrame->paintScrollViewRectToContextAtPoint(rect, pt, deviceContext);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebView.h (190234 => 190235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebView.h        2015-09-25 02:56:47 UTC (rev 190234)
+++ trunk/Source/WebKit/win/WebView.h        2015-09-25 03:41:35 UTC (rev 190235)
</span><span class="lines">@@ -569,6 +569,7 @@
</span><span class="cx"> static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
</span><span class="cx">
</span><span class="cx"> void updateWindowIfNeeded(HWND hWnd, UINT message);
</span><ins>+ bool paintCompositedContentToHDC(HDC);
</ins><span class="cx">
</span><span class="cx"> HIMC getIMMContext();
</span><span class="cx"> void releaseIMMContext(HIMC);
</span></span></pre>
</div>
</div>
</body>
</html>