| Index: Source/WebKit/chromium/src/WebViewImpl.cpp
|
| diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp
|
| index 0c5107d4e21f25f80860768fb51a5600794565d9..6d0350878a1439b6c76b23d92fbe8008532e206f 100644
|
| --- a/Source/WebKit/chromium/src/WebViewImpl.cpp
|
| +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp
|
| @@ -59,6 +59,7 @@
|
| #include "GraphicsLayerFactoryChromium.h"
|
| #include "HTMLNames.h"
|
| #include "LinkHighlight.h"
|
| +#include "NonCompositedContentHost.h"
|
| #include "PageWidgetDelegate.h"
|
| #include "PrerendererClientImpl.h"
|
| #include "SpeechInputClientImpl.h"
|
| @@ -1784,8 +1785,6 @@ void WebViewImpl::layout()
|
| {
|
| TRACE_EVENT0("webkit", "WebViewImpl::layout");
|
| PageWidgetDelegate::layout(m_page.get());
|
| - if (m_layerTreeView)
|
| - m_layerTreeView->setBackgroundColor(backgroundColor());
|
|
|
| if (m_linkHighlight)
|
| m_linkHighlight->updateGeometry();
|
| @@ -2952,7 +2951,8 @@ void WebViewImpl::enableFixedLayoutMode(bool enable)
|
|
|
| frame->view()->setUseFixedLayout(enable);
|
|
|
| - if (m_isAcceleratedCompositingActive)
|
| + // Also notify the base layer, which RenderLayerCompositor does not see.
|
| + if (m_nonCompositedContentHost)
|
| updateLayerTreeViewport();
|
| }
|
|
|
| @@ -3547,6 +3547,9 @@ void WebViewImpl::setIsTransparent(bool isTransparent)
|
|
|
| // Future frames check this to know whether to be transparent.
|
| m_isTransparent = isTransparent;
|
| +
|
| + if (m_nonCompositedContentHost)
|
| + m_nonCompositedContentHost->setOpaque(!isTransparent);
|
| }
|
|
|
| bool WebViewImpl::isTransparent() const
|
| @@ -3848,6 +3851,16 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
|
| m_rootLayer = layer ? layer->platformLayer() : 0;
|
|
|
| setIsAcceleratedCompositingActive(layer);
|
| + if (m_nonCompositedContentHost) {
|
| + GraphicsLayer* scrollLayer = 0;
|
| + if (layer) {
|
| + Document* document = page()->mainFrame()->document();
|
| + RenderView* renderView = document->renderView();
|
| + RenderLayerCompositor* compositor = renderView->compositor();
|
| + scrollLayer = compositor->scrollLayer();
|
| + }
|
| + m_nonCompositedContentHost->setScrollLayer(scrollLayer);
|
| + }
|
|
|
| if (m_layerTreeView) {
|
| if (m_rootLayer)
|
| @@ -3880,11 +3893,31 @@ void WebViewImpl::invalidateRect(const IntRect& rect)
|
| }
|
| if (m_isAcceleratedCompositingActive) {
|
| ASSERT(m_layerTreeView);
|
| +
|
| + if (!page())
|
| + return;
|
| +
|
| + FrameView* view = page()->mainFrame()->view();
|
| + IntRect dirtyRect = view->windowToContents(rect);
|
| updateLayerTreeViewport();
|
| + m_nonCompositedContentHost->invalidateRect(dirtyRect);
|
| } else if (m_client)
|
| m_client->didInvalidateRect(rect);
|
| }
|
|
|
| +NonCompositedContentHost* WebViewImpl::nonCompositedContentHost()
|
| +{
|
| + return m_nonCompositedContentHost.get();
|
| +}
|
| +
|
| +void WebViewImpl::setBackgroundColor(const WebCore::Color& color)
|
| +{
|
| + WebCore::Color documentBackgroundColor = color.isValid() ? color : WebCore::Color::white;
|
| + WebColor webDocumentBackgroundColor = documentBackgroundColor.rgb();
|
| + m_nonCompositedContentHost->setBackgroundColor(documentBackgroundColor);
|
| + m_layerTreeView->setBackgroundColor(webDocumentBackgroundColor);
|
| +}
|
| +
|
| WebCore::GraphicsLayerFactory* WebViewImpl::graphicsLayerFactory() const
|
| {
|
| return m_graphicsLayerFactory.get();
|
| @@ -3913,6 +3946,22 @@ void WebViewImpl::scheduleAnimation()
|
| m_client->scheduleAnimation();
|
| }
|
|
|
| +void WebViewImpl::paintRootLayer(GraphicsContext& context, const IntRect& contentRect)
|
| +{
|
| + double paintStart = currentTime();
|
| + if (!page())
|
| + return;
|
| + FrameView* view = page()->mainFrame()->view();
|
| + context.setUseHighResMarkers(page()->deviceScaleFactor() > 1.5f);
|
| + view->paintContents(&context, contentRect);
|
| + double paintEnd = currentTime();
|
| + double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintEnd - paintStart);
|
| + WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelRootPaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30);
|
| + WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelRootPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30);
|
| +
|
| + setBackgroundColor(view->documentBackgroundColor());
|
| +}
|
| +
|
| void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
|
| {
|
| WebKit::Platform::current()->histogramEnumeration("GPU.setIsAcceleratedCompositingActive", active * 2 + m_isAcceleratedCompositingActive, 4);
|
| @@ -3945,6 +3994,10 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
|
| } else {
|
| TRACE_EVENT0("webkit", "WebViewImpl::setIsAcceleratedCompositingActive(true)");
|
|
|
| + m_nonCompositedContentHost = NonCompositedContentHost::create(this, graphicsLayerFactory());
|
| + m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders());
|
| + m_nonCompositedContentHost->setOpaque(!isTransparent());
|
| +
|
| m_client->initializeLayerTreeView();
|
| m_layerTreeView = m_client->layerTreeView();
|
| if (m_layerTreeView) {
|
| @@ -3954,7 +4007,6 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
|
| m_layerTreeView->setVisible(visible);
|
| m_layerTreeView->setDeviceScaleFactor(page()->deviceScaleFactor());
|
| m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
|
| - m_layerTreeView->setBackgroundColor(backgroundColor());
|
| m_layerTreeView->setHasTransparentBackground(isTransparent());
|
| updateLayerTreeViewport();
|
| m_client->didActivateCompositor(m_inputHandlerIdentifier);
|
| @@ -3967,6 +4019,7 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
|
| m_layerTreeView->setShowDebugBorders(m_showDebugBorders);
|
| m_layerTreeView->setContinuousPaintingEnabled(m_continuousPaintingEnabled);
|
| } else {
|
| + m_nonCompositedContentHost.clear();
|
| m_isAcceleratedCompositingActive = false;
|
| m_client->didDeactivateCompositor();
|
| m_compositorCreationFailed = true;
|
| @@ -4037,9 +4090,11 @@ void WebViewImpl::didExitCompositingMode()
|
|
|
| void WebViewImpl::updateLayerTreeViewport()
|
| {
|
| - if (!page() || !m_layerTreeView)
|
| + if (!page() || !m_nonCompositedContentHost || !m_layerTreeView)
|
| return;
|
|
|
| + FrameView* view = page()->mainFrame()->view();
|
| + m_nonCompositedContentHost->setViewport(m_size, view->contentsSize(), view->scrollPosition(), view->scrollOrigin());
|
| m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
|
| }
|
|
|
|
|