Title: [133544] trunk/Source/WebCore
Revision
133544
Author
simon.fra...@apple.com
Date
2012-11-05 17:45:43 -0800 (Mon, 05 Nov 2012)

Log Message

RenderGeometryMap asserts when loading http://en.softonic.com/mac
https://bugs.webkit.org/show_bug.cgi?id=101284
<rdar://problem/11540560>

Reviewed by Tim Horton.

When FrameView::layout() calls document->updateStyleIfNeeded(), we
can be in a state where FrameView::needsLayout() is false. However,
this is a bad time to update compositing layers, because we're about
to do layout, which will require us to update them again soon anyway,
and some RenderLayers may not have been sized or positioned yet.

Fix by adding a m_doingPreLayoutStyleUpdate member to FrameView,
and toggling it around this call to updateStyleIfNeeded().
Read this state in updateCompositingLayersAfterStyleChange(), which is
now called unconditionally by recalcStyle(), but returns early
if this flag is set, or layout is pending.

* dom/Document.cpp:
(WebCore::Document::recalcStyle):
* page/FrameView.cpp:
(WebCore::FrameView::reset):
(WebCore::FrameView::updateCompositingLayersAfterStyleChange):
(WebCore::FrameView::layout):
* page/FrameView.h:
(FrameView):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (133543 => 133544)


--- trunk/Source/WebCore/ChangeLog	2012-11-06 00:54:19 UTC (rev 133543)
+++ trunk/Source/WebCore/ChangeLog	2012-11-06 01:45:43 UTC (rev 133544)
@@ -1,3 +1,32 @@
+2012-11-05  Simon Fraser  <simon.fra...@apple.com>
+
+        RenderGeometryMap asserts when loading http://en.softonic.com/mac
+        https://bugs.webkit.org/show_bug.cgi?id=101284
+        <rdar://problem/11540560>
+
+        Reviewed by Tim Horton.
+
+        When FrameView::layout() calls document->updateStyleIfNeeded(), we
+        can be in a state where FrameView::needsLayout() is false. However,
+        this is a bad time to update compositing layers, because we're about
+        to do layout, which will require us to update them again soon anyway,
+        and some RenderLayers may not have been sized or positioned yet.
+        
+        Fix by adding a m_doingPreLayoutStyleUpdate member to FrameView,
+        and toggling it around this call to updateStyleIfNeeded().
+        Read this state in updateCompositingLayersAfterStyleChange(), which is
+        now called unconditionally by recalcStyle(), but returns early
+        if this flag is set, or layout is pending.
+
+        * dom/Document.cpp:
+        (WebCore::Document::recalcStyle):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::reset):
+        (WebCore::FrameView::updateCompositingLayersAfterStyleChange):
+        (WebCore::FrameView::layout):
+        * page/FrameView.h:
+        (FrameView):
+
 2012-11-05  Beth Dakin  <bda...@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=101275

Modified: trunk/Source/WebCore/dom/Document.cpp (133543 => 133544)


--- trunk/Source/WebCore/dom/Document.cpp	2012-11-06 00:54:19 UTC (rev 133543)
+++ trunk/Source/WebCore/dom/Document.cpp	2012-11-06 01:45:43 UTC (rev 133544)
@@ -1852,14 +1852,10 @@
                 element->recalcStyle(change);
         }
 
-    #if USE(ACCELERATED_COMPOSITING)
-        if (view()) {
-            bool layoutPending = view()->layoutPending() || renderer()->needsLayout();
-            // If we didn't update compositing layers because of layout(), we need to do so here.
-            if (!layoutPending)
-                view()->updateCompositingLayersAfterStyleChange();
-        }
-    #endif
+#if USE(ACCELERATED_COMPOSITING)
+        if (view())
+            view()->updateCompositingLayersAfterStyleChange();
+#endif
 
     bailOut:
         clearNeedsStyleRecalc();

Modified: trunk/Source/WebCore/page/FrameView.cpp (133543 => 133544)


--- trunk/Source/WebCore/page/FrameView.cpp	2012-11-06 00:54:19 UTC (rev 133543)
+++ trunk/Source/WebCore/page/FrameView.cpp	2012-11-06 01:45:43 UTC (rev 133544)
@@ -267,6 +267,7 @@
     m_doFullRepaint = true;
     m_layoutSchedulingEnabled = true;
     m_inLayout = false;
+    m_doingPreLayoutStyleUpdate = false;
     m_inSynchronousPostLayout = false;
     m_layoutCount = 0;
     m_nestedLayoutCount = 0;
@@ -707,6 +708,10 @@
     if (!root)
         return;
 
+    // If we expect to update compositing after an incipient layout, don't do so here.
+    if (m_doingPreLayoutStyleUpdate || layoutPending() || root->needsLayout())
+        return;
+
     // This call will make sure the cached hasAcceleratedCompositing is updated from the pref
     root->compositor()->cacheAcceleratedCompositingFlags();
     root->compositor()->updateCompositingLayers(CompositingUpdateAfterStyleChange);
@@ -1065,6 +1070,7 @@
 
         // Always ensure our style info is up-to-date. This can happen in situations where
         // the layout beats any sort of style recalc update that needs to occur.
+        TemporaryChange<bool> changeDoingPreLayoutStyleUpdate(m_doingPreLayoutStyleUpdate, true);
         document->updateStyleIfNeeded();
 
         subtree = m_layoutRoot;

Modified: trunk/Source/WebCore/page/FrameView.h (133543 => 133544)


--- trunk/Source/WebCore/page/FrameView.h	2012-11-06 00:54:19 UTC (rev 133543)
+++ trunk/Source/WebCore/page/FrameView.h	2012-11-06 01:45:43 UTC (rev 133544)
@@ -487,6 +487,7 @@
     
     bool m_layoutSchedulingEnabled;
     bool m_inLayout;
+    bool m_doingPreLayoutStyleUpdate;
     bool m_inSynchronousPostLayout;
     int m_layoutCount;
     unsigned m_nestedLayoutCount;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to