[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

bdakin at apple.com bdakin at apple.com
Wed Dec 22 12:52:45 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit aa86567c2b2021dcb7d03c2fba4e87e8751883b8
Author: bdakin at apple.com <bdakin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 31 23:21:57 2010 +0000

    Fix for https://bugs.webkit.org/show_bug.cgi?id=44828 FrameView
    should make more calls to postLayoutTasks() using the timer
    -and corresponding-
    <rdar://problem/8064938>
    
    Reviewed by Dave Hyatt.
    
    WebCore:
    
    This change only allows synchronous calls to postLayoutTasks() if
    we are not already in a synchronous call to postLayoutTasks().
    Furthermore, it de-couples the notion of "the post layout timer
    should fire" from m_postLayoutTasksTimer.isActive(), instead using
    a boolean to track the need to use the timer.
    
    * page/FrameView.cpp:
    (WebCore::FrameView::FrameView):
    (WebCore::FrameView::~FrameView):
    (WebCore::FrameView::reset):
    (WebCore::FrameView::layout):
    (WebCore::FrameView::unscheduleRelayout):
    (WebCore::FrameView::performPostLayoutTasks):
    * page/FrameView.h:
    
    LayoutTests:
    
    * fast/events/change-overflow-on-overflow-change-expected.txt: Added.
    * fast/events/change-overflow-on-overflow-change.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66552 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 1aea38a..20eff82 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-08-31  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        Fix for https://bugs.webkit.org/show_bug.cgi?id=44828 FrameView 
+        should make more calls to postLayoutTasks() using the timer
+        -and corresponding-
+        <rdar://problem/8064938>
+
+        * fast/events/change-overflow-on-overflow-change-expected.txt: Added.
+        * fast/events/change-overflow-on-overflow-change.html: Added.
+
 2010-08-31  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/LayoutTests/fast/dom/beforeload/image-object-before-load-expected.txt b/LayoutTests/fast/events/change-overflow-on-overflow-change-expected.txt
similarity index 100%
copy from LayoutTests/fast/dom/beforeload/image-object-before-load-expected.txt
copy to LayoutTests/fast/events/change-overflow-on-overflow-change-expected.txt
diff --git a/LayoutTests/fast/events/change-overflow-on-overflow-change.html b/LayoutTests/fast/events/change-overflow-on-overflow-change.html
new file mode 100644
index 0000000..11026e5
--- /dev/null
+++ b/LayoutTests/fast/events/change-overflow-on-overflow-change.html
@@ -0,0 +1,67 @@
+<body>
+<div id="result"></div>
+<div style="position: relative; height: 200px; overflow: auto;">
+    <div id="target" style="height: 75%; background-color: red;"></div>
+</div>
+<script>
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+
+    window.onload = function () {
+        // Force a layout with offsetHeight, and then start toggling overflow.
+        target.offsetHeight;
+        toggleOverflow();
+    }
+
+    var callCount = 0;
+    var recursionDepth = 0;
+
+    var target = document.getElementById("target");
+    var result = document.getElementById("result");
+    
+    function pass()
+    {
+        result.innerHTML = "PASS";
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }
+    
+    function fail()
+    {
+        result.innerHTML = "FAIL";
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }
+
+    function toggleOverflow()
+    {
+        ++recursionDepth;
+        ++callCount;
+
+        // The code change associated with this test will cause this function to start 
+        // firing asynchronously.
+        if (recursionDepth > 2) {
+            fail();
+            return;
+        }
+
+        // If we have made it this far without a recursionDepth of 2 or greater, then we 
+        // can say that the test passed.
+        if (callCount > 8) {
+            pass();
+            return;
+        }
+
+        if (target.style.height === "75%")
+            target.style.height = "200%";
+        else
+            target.style.height = "75%";
+        target.offsetHeight;
+
+        --recursionDepth;
+    }
+    target.parentNode.addEventListener("overflowchanged", toggleOverflow);
+</script>
+</body>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2b6a9f3..2459842 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2010-08-31  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        Fix for https://bugs.webkit.org/show_bug.cgi?id=44828 FrameView 
+        should make more calls to postLayoutTasks() using the timer
+        -and corresponding-
+        <rdar://problem/8064938>
+
+        This change only allows synchronous calls to postLayoutTasks() if 
+        we are not already in a synchronous call to postLayoutTasks(). 
+        Furthermore, it de-couples the notion of "the post layout timer 
+        should fire" from m_postLayoutTasksTimer.isActive(), instead using 
+        a boolean to track the need to use the timer.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::FrameView):
+        (WebCore::FrameView::~FrameView):
+        (WebCore::FrameView::reset):
+        (WebCore::FrameView::layout):
+        (WebCore::FrameView::unscheduleRelayout):
+        (WebCore::FrameView::performPostLayoutTasks):
+        * page/FrameView.h:
+
 2010-08-30  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 51ed056..5cd2cb8 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -128,6 +128,8 @@ FrameView::FrameView(Frame* frame)
     , m_fixedObjectCount(0)
     , m_layoutTimer(this, &FrameView::layoutTimerFired)
     , m_layoutRoot(0)
+    , m_shouldFirePostLayoutTimer(false)
+    , m_inSynchronousPostLayout(false)
     , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired)
     , m_isTransparent(false)
     , m_baseBackgroundColor(Color::white)
@@ -164,7 +166,7 @@ PassRefPtr<FrameView> FrameView::create(Frame* frame, const IntSize& initialSize
 
 FrameView::~FrameView()
 {
-    if (m_postLayoutTasksTimer.isActive()) {
+    if (m_shouldFirePostLayoutTimer) {
         m_postLayoutTasksTimer.stop();
         m_scheduledEvents.clear();
         m_enqueueEvents = 0;
@@ -204,6 +206,8 @@ void FrameView::reset()
     m_doFullRepaint = true;
     m_layoutSchedulingEnabled = true;
     m_inLayout = false;
+    m_inSynchronousPostLayout = false;
+    m_shouldFirePostLayoutTimer = false;
     m_layoutCount = 0;
     m_nestedLayoutCount = 0;
     m_postLayoutTasksTimer.stop();
@@ -638,11 +642,13 @@ void FrameView::layout(bool allowSubtree)
 
     m_layoutSchedulingEnabled = false;
 
-    if (!m_nestedLayoutCount && m_postLayoutTasksTimer.isActive()) {
+    if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_shouldFirePostLayoutTimer) {
         // This is a new top-level layout. If there are any remaining tasks from the previous
         // layout, finish them now.
+        m_inSynchronousPostLayout = true;
         m_postLayoutTasksTimer.stop();
         performPostLayoutTasks();
+        m_inSynchronousPostLayout = false;
     }
 
     // Viewport-dependent media queries may cause us to need completely different style information.
@@ -821,17 +827,25 @@ void FrameView::layout(bool allowSubtree)
         updateOverflowStatus(layoutWidth() < contentsWidth(),
                              layoutHeight() < contentsHeight());
 
-    if (!m_postLayoutTasksTimer.isActive()) {
-        // Calls resumeScheduledEvents()
-        performPostLayoutTasks();
+    if (!m_shouldFirePostLayoutTimer) {
+        if (!m_inSynchronousPostLayout) {
+            m_inSynchronousPostLayout = true;
+            // Calls resumeScheduledEvents()
+            performPostLayoutTasks();
+            m_inSynchronousPostLayout = false;
+        }
 
-        if (!m_postLayoutTasksTimer.isActive() && needsLayout()) {
-            // Post-layout widget updates or an event handler made us need layout again.
-            // Lay out again, but this time defer widget updates and event dispatch until after
-            // we return.
+        if (!m_shouldFirePostLayoutTimer && (needsLayout() || m_inSynchronousPostLayout)) {
+            // If we need layout or are already in a synchronous call to postLayoutTasks(), 
+            // defer widget updates and event dispatch until after we return. postLayoutTasks()
+            // can make us need to update again, and we can get stuck in a nasty cycle unless
+            // we call it through the timer here.
+            m_shouldFirePostLayoutTimer = true;
             m_postLayoutTasksTimer.startOneShot(0);
-            pauseScheduledEvents();
-            layout();
+            if (needsLayout()) {
+                pauseScheduledEvents();
+                layout();
+            }
         }
     } else {
         resumeScheduledEvents();
@@ -1452,6 +1466,8 @@ void FrameView::setNeedsLayout()
 
 void FrameView::unscheduleRelayout()
 {
+    m_postLayoutTasksTimer.stop();
+
     if (!m_layoutTimer.isActive())
         return;
 
@@ -1595,6 +1611,8 @@ bool FrameView::updateWidgets()
     
 void FrameView::performPostLayoutTasks()
 {
+    m_shouldFirePostLayoutTimer = false;
+
     if (m_firstLayoutCallbackPending) {
         m_firstLayoutCallbackPending = false;
         m_frame->loader()->didFirstLayout();
diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h
index 47dff43..ec8efde 100644
--- a/WebCore/page/FrameView.h
+++ b/WebCore/page/FrameView.h
@@ -319,6 +319,8 @@ private:
     
     bool m_layoutSchedulingEnabled;
     bool m_inLayout;
+    bool m_shouldFirePostLayoutTimer;
+    bool m_inSynchronousPostLayout;
     int m_layoutCount;
     unsigned m_nestedLayoutCount;
     Timer<FrameView> m_postLayoutTasksTimer;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list