Title: [134953] trunk/Source/WebKit2
Revision
134953
Author
commit-qu...@webkit.org
Date
2012-11-16 08:19:54 -0800 (Fri, 16 Nov 2012)

Log Message

[EFL][WK2] White flicker when scrolling big pages with dark background on slower hardware.
https://bugs.webkit.org/show_bug.cgi?id=102000

Patch by Viatcheslav Ostapenko <v.ostape...@samsung.com> on 2012-11-16
Reviewed by Kenneth Rohde Christiansen.

Add matching of view background color to the page background. This helps to reduce
visibility of flicker during scrolling/scaling/repainting where page tiles are not
ready. View background color matching is disabled by default and can be enabled
with new API function ewk_view_draws_page_background_set .
View background color can interfere with semi-transparent pages and should be
disabled by default.
Upstreaming changes by Youngtaeck Song(youngtaeck.s...@samsung.com).

* UIProcess/API/efl/EwkViewImpl.cpp:
(EwkViewImpl::EwkViewImpl):
(EwkViewImpl::displayTimerFired):
* UIProcess/API/efl/EwkViewImpl.h:
(EwkViewImpl::setDrawsBackground):
(EwkViewImpl):
* UIProcess/API/efl/ewk_view.cpp:
(ewk_view_draws_page_background_set):
* UIProcess/API/efl/ewk_view.h:
* UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp:
(WebKit::LayerTreeCoordinatorProxy::setBackgroundColor):
(WebKit):
* UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h:
(LayerTreeCoordinatorProxy):
* UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in:
* UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
(WebKit::LayerTreeRenderer::LayerTreeRenderer):
(WebKit::LayerTreeRenderer::paintToCurrentGLContext):
(WebKit::LayerTreeRenderer::paintToGraphicsContext):
(WebKit::LayerTreeRenderer::setBackgroundColor):
(WebKit):
* UIProcess/CoordinatedGraphics/LayerTreeRenderer.h:
(LayerTreeRenderer):
(WebKit::LayerTreeRenderer::setDrawsBackground):
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp:
(WebKit::LayerTreeCoordinator::setBackgroundColor):
(WebKit):
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h:
(LayerTreeCoordinator):
* WebProcess/WebPage/LayerTreeHost.h:
(WebKit::LayerTreeHost::setBackgroundColor):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::mainFrameDidLayout):
* WebProcess/WebPage/WebPage.h:
(WebPage):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (134952 => 134953)


--- trunk/Source/WebKit2/ChangeLog	2012-11-16 16:12:15 UTC (rev 134952)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-16 16:19:54 UTC (rev 134953)
@@ -1,3 +1,55 @@
+2012-11-16  Viatcheslav Ostapenko  <v.ostape...@samsung.com>
+
+        [EFL][WK2] White flicker when scrolling big pages with dark background on slower hardware.
+        https://bugs.webkit.org/show_bug.cgi?id=102000
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Add matching of view background color to the page background. This helps to reduce 
+        visibility of flicker during scrolling/scaling/repainting where page tiles are not
+        ready. View background color matching is disabled by default and can be enabled 
+        with new API function ewk_view_draws_page_background_set .
+        View background color can interfere with semi-transparent pages and should be
+        disabled by default.
+        Upstreaming changes by Youngtaeck Song(youngtaeck.s...@samsung.com).
+
+        * UIProcess/API/efl/EwkViewImpl.cpp:
+        (EwkViewImpl::EwkViewImpl):
+        (EwkViewImpl::displayTimerFired):
+        * UIProcess/API/efl/EwkViewImpl.h:
+        (EwkViewImpl::setDrawsBackground):
+        (EwkViewImpl):
+        * UIProcess/API/efl/ewk_view.cpp:
+        (ewk_view_draws_page_background_set):
+        * UIProcess/API/efl/ewk_view.h:
+        * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp:
+        (WebKit::LayerTreeCoordinatorProxy::setBackgroundColor):
+        (WebKit):
+        * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h:
+        (LayerTreeCoordinatorProxy):
+        * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in:
+        * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
+        (WebKit::LayerTreeRenderer::LayerTreeRenderer):
+        (WebKit::LayerTreeRenderer::paintToCurrentGLContext):
+        (WebKit::LayerTreeRenderer::paintToGraphicsContext):
+        (WebKit::LayerTreeRenderer::setBackgroundColor):
+        (WebKit):
+        * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h:
+        (LayerTreeRenderer):
+        (WebKit::LayerTreeRenderer::setDrawsBackground):
+        * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp:
+        (WebKit::LayerTreeCoordinator::setBackgroundColor):
+        (WebKit):
+        * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h:
+        (LayerTreeCoordinator):
+        * WebProcess/WebPage/LayerTreeHost.h:
+        (WebKit::LayerTreeHost::setBackgroundColor):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+        (WebKit::WebPage::mainFrameDidLayout):
+        * WebProcess/WebPage/WebPage.h:
+        (WebPage):
+
 2012-11-16  Krzysztof Czech  <k.cz...@samsung.com>
 
         [WK2][GTK][EFL] Share WebKit2-GTK's WebProcess Accessibility implementation with other WebKit ports.

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp (134952 => 134953)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp	2012-11-16 16:12:15 UTC (rev 134952)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp	2012-11-16 16:19:54 UTC (rev 134953)
@@ -132,6 +132,7 @@
     , m_displayTimer(this, &EwkViewImpl::displayTimerFired)
     , m_inputMethodContext(InputMethodContextEfl::create(this, smartData()->base.evas))
     , m_isHardwareAccelerated(true)
+    , m_setDrawsBackground(false)
 {
     ASSERT(m_view);
     ASSERT(m_context);
@@ -338,6 +339,7 @@
 
     LayerTreeRenderer* renderer = page()->drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer();
     renderer->setActive(true);
+    renderer->setDrawsBackground(m_setDrawsBackground);
     renderer->syncRemoteContent();
     if (m_isHardwareAccelerated) {
         renderer->paintToCurrentGLContext(transformToScene().toTransformationMatrix(), /* opacity */ 1, viewport);

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h (134952 => 134953)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h	2012-11-16 16:12:15 UTC (rev 134952)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h	2012-11-16 16:19:54 UTC (rev 134953)
@@ -200,6 +200,7 @@
     void informURLChange();
 
     bool isHardwareAccelerated() const { return m_isHardwareAccelerated; }
+    void setDrawsBackground(bool enable) { m_setDrawsBackground = enable; }
 
 private:
     inline Ewk_View_Smart_Data* smartData() const;
@@ -258,6 +259,7 @@
     OwnPtr<WebKit::InputMethodContextEfl> m_inputMethodContext;
     OwnPtr<Ewk_Color_Picker> m_colorPicker;
     bool m_isHardwareAccelerated;
+    bool m_setDrawsBackground;
 };
 
 #endif // EwkViewImpl_h

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (134952 => 134953)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-11-16 16:12:15 UTC (rev 134952)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-11-16 16:19:54 UTC (rev 134953)
@@ -921,3 +921,10 @@
     return false;
 #endif
 }
+
+void ewk_view_draws_page_background_set(Evas_Object *ewkView, Eina_Bool enabled)
+{
+    EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
+
+    impl->setDrawsBackground(enabled);
+}

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h (134952 => 134953)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h	2012-11-16 16:12:15 UTC (rev 134952)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h	2012-11-16 16:19:54 UTC (rev 134953)
@@ -814,6 +814,22 @@
  */
 EAPI Eina_Bool ewk_view_fullscreen_exit(Evas_Object *o);
 
+/**
+ * Sets whether the ewk_view background matches page background color.
+ *
+ * If enabled sets view background color close to page color on page load.
+ * This helps to reduce flicker on page scrolling and repainting in places
+ * where page content is not ready for painting.
+ * View background color can interfere with semi-transparent pages and is
+ * disabled by default.
+ *
+ * @param o view object to enable/disable background matching
+ * @param enabled a state to set
+ *
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
+ */
+EAPI void ewk_view_draws_page_background_set(Evas_Object *o, Eina_Bool enabled);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp (134952 => 134953)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp	2012-11-16 16:12:15 UTC (rev 134952)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp	2012-11-16 16:19:54 UTC (rev 134953)
@@ -209,5 +209,10 @@
     m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeCoordinator::PurgeBackingStores(), m_drawingAreaProxy->page()->pageID());
 }
 
+void LayerTreeCoordinatorProxy::setBackgroundColor(const WebCore::Color& color)
+{
+    dispatchUpdate(bind(&LayerTreeRenderer::setBackgroundColor, m_renderer.get(), color));
 }
+
+}
 #endif // USE(COORDINATED_GRAPHICS)

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h (134952 => 134953)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h	2012-11-16 16:12:15 UTC (rev 134952)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h	2012-11-16 16:19:54 UTC (rev 134953)
@@ -85,6 +85,7 @@
     void requestAnimationFrame();
     void animationFrameReady();
 #endif
+    void setBackgroundColor(const WebCore::Color&);
 
 protected:
     void dispatchUpdate(const Function<void()>&);

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in (134952 => 134953)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in	2012-11-16 16:12:15 UTC (rev 134952)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in	2012-11-16 16:19:54 UTC (rev 134953)
@@ -46,5 +46,7 @@
 #if USE(GRAPHICS_SURFACE)
     SyncCanvas(uint32_t id, WebCore::IntSize canvasSize, WebCore::GraphicsSurfaceToken token, uint32_t frontBuffer)
 #endif
+
+    SetBackgroundColor(WebCore::Color color)
 }
 #endif

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp (134952 => 134953)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp	2012-11-16 16:12:15 UTC (rev 134952)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp	2012-11-16 16:19:54 UTC (rev 134953)
@@ -93,6 +93,8 @@
     , m_animationFrameRequested(false)
 #endif
     , m_accelerationMode(TextureMapper::OpenGLMode)
+    , m_backgroundColor(Color::white)
+    , m_setDrawsBackground(false)
 {
 }
 
@@ -130,6 +132,13 @@
     m_textureMapper->beginPainting(PaintFlags);
     m_textureMapper->beginClip(TransformationMatrix(), clipRect);
 
+    if (m_setDrawsBackground) {
+        RGBA32 rgba = makeRGBA32FromFloats(m_backgroundColor.red(),
+            m_backgroundColor.green(), m_backgroundColor.blue(),
+            m_backgroundColor.alpha() * opacity);
+        m_textureMapper->drawSolidColor(clipRect, TransformationMatrix(), Color(rgba));
+    }
+
     if (currentRootLayer->opacity() != opacity || currentRootLayer->transform() != matrix) {
         currentRootLayer->setOpacity(opacity);
         currentRootLayer->setTransform(matrix);
@@ -178,6 +187,10 @@
     GraphicsContext graphicsContext(painter);
     m_textureMapper->setGraphicsContext(&graphicsContext);
     m_textureMapper->beginPainting();
+
+    if (m_setDrawsBackground)
+        m_textureMapper->drawSolidColor(graphicsContext.clipBounds(), TransformationMatrix(), m_backgroundColor);
+
     layer->paint();
     m_textureMapper->endPainting();
     m_textureMapper->setGraphicsContext(0);
@@ -607,6 +620,11 @@
         renderNextFrame();
 }
 
+void LayerTreeRenderer::setBackgroundColor(const WebCore::Color& color)
+{
+    m_backgroundColor = color;
+}
+
 } // namespace WebKit
 
 #endif // USE(COORDINATED_GRAPHICS)

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h (134952 => 134953)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h	2012-11-16 16:12:15 UTC (rev 134952)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h	2012-11-16 16:19:54 UTC (rev 134953)
@@ -94,6 +94,8 @@
     void removeImageBacking(CoordinatedImageBackingID);
     void setLayerAnimations(WebLayerID, const WebCore::GraphicsLayerAnimations&);
     void setAnimationsLocked(bool);
+    void setBackgroundColor(const WebCore::Color&);
+    void setDrawsBackground(bool enable) { m_setDrawsBackground = enable; }
 
 #if ENABLE(REQUEST_ANIMATION_FRAME)
     void requestAnimationFrame();
@@ -167,6 +169,8 @@
     bool m_animationFrameRequested;
 #endif
     WebCore::TextureMapper::AccelerationMode m_accelerationMode;
+    WebCore::Color m_backgroundColor;
+    bool m_setDrawsBackground;
 };
 
 };

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp (134952 => 134953)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp	2012-11-16 16:12:15 UTC (rev 134952)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp	2012-11-16 16:19:54 UTC (rev 134953)
@@ -775,5 +775,10 @@
         m_releaseInactiveAtlasesTimer.stop();
 }
 
+void LayerTreeCoordinator::setBackgroundColor(const WebCore::Color& color)
+{
+    m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetBackgroundColor(color));
+}
+
 } // namespace WebKit
 #endif // USE(COORDINATED_GRAPHICS)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h (134952 => 134953)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h	2012-11-16 16:12:15 UTC (rev 134952)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h	2012-11-16 16:19:54 UTC (rev 134953)
@@ -111,6 +111,7 @@
 #if ENABLE(REQUEST_ANIMATION_FRAME)
     virtual void scheduleAnimation() OVERRIDE;
 #endif
+    virtual void setBackgroundColor(const WebCore::Color&) OVERRIDE;
 
 protected:
     explicit LayerTreeCoordinator(WebPage*);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h (134952 => 134953)


--- trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h	2012-11-16 16:12:15 UTC (rev 134952)
+++ trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h	2012-11-16 16:19:54 UTC (rev 134953)
@@ -27,6 +27,7 @@
 #define LayerTreeHost_h
 
 #include "LayerTreeContext.h"
+#include <WebCore/Color.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
@@ -88,6 +89,7 @@
     virtual void resumeRendering() { }
 
     virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() { return 0; }
+    virtual void setBackgroundColor(const WebCore::Color&) { }
 
 #if USE(COORDINATED_GRAPHICS)
     virtual void setVisibleContentsRect(const WebCore::IntRect&, float /* scale */, const WebCore::FloatPoint&) { }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (134952 => 134953)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-11-16 16:12:15 UTC (rev 134952)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-11-16 16:19:54 UTC (rev 134953)
@@ -276,6 +276,7 @@
     , m_visibilityState(WebCore::PageVisibilityStateVisible)
 #endif
     , m_inspectorClient(0)
+    , m_backgroundColor(Color::white)
 {
     ASSERT(m_pageID);
     // FIXME: This is a non-ideal location for this Setting and
@@ -2764,6 +2765,18 @@
         send(Messages::WebPageProxy::DidChangePageCount(pageCount));
         m_cachedPageCount = pageCount;
     }
+
+#if USE(TILED_BACKING_STORE) && USE(ACCELERATED_COMPOSITING)
+    if (m_drawingArea && m_drawingArea->layerTreeHost()) {
+        double red, green, blue, alpha;
+        m_mainFrame->getDocumentBackgroundColor(&red, &green, &blue, &alpha);
+        RGBA32 rgba = makeRGBA32FromFloats(red, green, blue, alpha);
+        if (m_backgroundColor.rgb() != rgba) {
+            m_backgroundColor.setRGB(rgba);
+            m_drawingArea->layerTreeHost()->setBackgroundColor(m_backgroundColor);
+        }
+    }
+#endif
 }
 
 void WebPage::addPluginView(PluginView* pluginView)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (134952 => 134953)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2012-11-16 16:12:15 UTC (rev 134952)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2012-11-16 16:19:54 UTC (rev 134953)
@@ -945,6 +945,7 @@
     WebInspectorClient* m_inspectorClient;
 
     HashSet<String, CaseFoldingHash> m_mimeTypesWithCustomRepresentations;
+    WebCore::Color m_backgroundColor;
 };
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to