Title: [134619] trunk/Source/WebCore
Revision
134619
Author
[email protected]
Date
2012-11-14 09:37:48 -0800 (Wed, 14 Nov 2012)

Log Message

Call to enclosingFilterLayer() in RenderObject::containerForRepaint() is expensive
https://bugs.webkit.org/show_bug.cgi?id=101846

Patch by Max Vujovic <[email protected]> on 2012-11-14
Reviewed by Simon Fraser.

If software-rendered CSS Filters have not been used in the document, avoid doing the second
tree walk in RenderObject::containerForRepaint, which determines the RenderObject's
enclosing filter layer.

No new tests. We now avoid a filters related code path for a performance improvement when
we're not using filters.

* page/FrameView.cpp:
(WebCore::FrameView::FrameView):
* page/FrameView.h:
(FrameView):
(WebCore::FrameView::setHasSoftwareFilters):
(WebCore::FrameView::hasSoftwareFilters):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateOrRemoveFilterEffectRenderer):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::containerForRepaint):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (134618 => 134619)


--- trunk/Source/WebCore/ChangeLog	2012-11-14 17:33:01 UTC (rev 134618)
+++ trunk/Source/WebCore/ChangeLog	2012-11-14 17:37:48 UTC (rev 134619)
@@ -1,3 +1,28 @@
+2012-11-14  Max Vujovic  <[email protected]>
+
+        Call to enclosingFilterLayer() in RenderObject::containerForRepaint() is expensive
+        https://bugs.webkit.org/show_bug.cgi?id=101846
+
+        Reviewed by Simon Fraser.
+
+        If software-rendered CSS Filters have not been used in the document, avoid doing the second
+        tree walk in RenderObject::containerForRepaint, which determines the RenderObject's
+        enclosing filter layer.
+
+        No new tests. We now avoid a filters related code path for a performance improvement when
+        we're not using filters.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::FrameView):
+        * page/FrameView.h:
+        (FrameView):
+        (WebCore::FrameView::setHasSoftwareFilters):
+        (WebCore::FrameView::hasSoftwareFilters):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateOrRemoveFilterEffectRenderer):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::containerForRepaint):
+
 2012-11-14  Erik Arvidsson  <[email protected]>
 
         Update DOMException name: NotFoundError

Modified: trunk/Source/WebCore/page/FrameView.cpp (134618 => 134619)


--- trunk/Source/WebCore/page/FrameView.cpp	2012-11-14 17:33:01 UTC (rev 134618)
+++ trunk/Source/WebCore/page/FrameView.cpp	2012-11-14 17:37:48 UTC (rev 134619)
@@ -192,6 +192,9 @@
     , m_shouldAutoSize(false)
     , m_inAutoSize(false)
     , m_didRunAutosize(false)
+#if ENABLE(CSS_FILTERS)
+    , m_hasSoftwareFilters(false)
+#endif
 {
     init();
 

Modified: trunk/Source/WebCore/page/FrameView.h (134618 => 134619)


--- trunk/Source/WebCore/page/FrameView.h	2012-11-14 17:33:01 UTC (rev 134618)
+++ trunk/Source/WebCore/page/FrameView.h	2012-11-14 17:37:48 UTC (rev 134619)
@@ -369,6 +369,11 @@
     bool inProgrammaticScroll() const { return m_inProgrammaticScroll; }
     void setInProgrammaticScroll(bool programmaticScroll) { m_inProgrammaticScroll = programmaticScroll; }
 
+#if ENABLE(CSS_FILTERS)
+    void setHasSoftwareFilters(bool hasSoftwareFilters) { m_hasSoftwareFilters = hasSoftwareFilters; }
+    bool hasSoftwareFilters() const { return m_hasSoftwareFilters; }
+#endif
+
 protected:
     virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
     virtual void scrollContentsSlowPath(const IntRect& updateRect);
@@ -564,6 +569,10 @@
     static double s_initialDeferredRepaintDelayDuringLoading;
     static double s_maxDeferredRepaintDelayDuringLoading;
     static double s_deferredRepaintDelayIncrementDuringLoading;
+
+#if ENABLE(CSS_FILTERS)
+    bool m_hasSoftwareFilters;
+#endif
 };
 
 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (134618 => 134619)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-11-14 17:33:01 UTC (rev 134618)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-11-14 17:37:48 UTC (rev 134619)
@@ -5262,6 +5262,9 @@
         RenderingMode renderingMode = renderer()->frame()->page()->settings()->acceleratedFiltersEnabled() ? Accelerated : Unaccelerated;
         filterRenderer->setRenderingMode(renderingMode);
         filterInfo->setRenderer(filterRenderer.release());
+        
+        // We can optimize away code paths in other places if we know that there are no software filters.
+        renderer()->document()->view()->setHasSoftwareFilters(true);
     }
 
     // If the filter fails to build, remove it from the layer. It will still attempt to

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (134618 => 134619)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2012-11-14 17:33:01 UTC (rev 134618)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2012-11-14 17:37:48 UTC (rev 134619)
@@ -1280,10 +1280,12 @@
 #endif
     
 #if ENABLE(CSS_FILTERS)
-    if (RenderLayer* parentLayer = enclosingLayer()) {
-        RenderLayer* enclosingFilterLayer = parentLayer->enclosingFilterLayer();
-        if (enclosingFilterLayer)
-            return enclosingFilterLayer->renderer();
+    if (document()->view()->hasSoftwareFilters()) {
+        if (RenderLayer* parentLayer = enclosingLayer()) {
+            RenderLayer* enclosingFilterLayer = parentLayer->enclosingFilterLayer();
+            if (enclosingFilterLayer)
+                return enclosingFilterLayer->renderer();
+        }
     }
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to