Title: [169128] trunk
Revision
169128
Author
[email protected]
Date
2014-05-20 13:34:35 -0700 (Tue, 20 May 2014)

Log Message

Element within flattened frame may update its scroll state during the layout phase of the wrong RenderView
https://bugs.webkit.org/show_bug.cgi?id=133013
<rdar://problem/16760154>

Reviewed by David Hyatt.

Source/WebCore:
Fixes an issue where the scroll state of an element may be updated during the layout of the wrong
RenderView. In particular, the scroll state of an element inside a CSS flex box in a flattened
frame f is updated during the layout of the RenderView associated with the parent frame of f instead
of during the layout of the RenderView associated with f.

The layout machinery assumes that the scroll state of each scrollable element is updated before the
completion of layout for its associated RenderView. Currently we have logic to defer updating the scroll
state of a scrollable element until completion of recursive layout. For a page with a flattened frame, we
defer such updates until completion of layout for all RenderViews along the ancestor frame hierarchy of
each flattened frame regardless of the RenderView associated with the element that originated the
deferred scroll state request. Instead, only the RenderView associated with the element that deferred its
scroll state update should dispatch the scroll state update.

Tests: fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-and-needs-full-repaint-crash.html
       fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-assertion-failure.html

* rendering/RenderBlock.cpp: Removed WTF::-prefix in typedef definition for ContinuationOutlineTableMap.
(WebCore::UpdateScrollInfoAfterLayoutTransaction::UpdateScrollInfoAfterLayoutTransaction): Added; a struct
that represents a RenderView v, nested transaction count, and a list of RenderBlocks in v that will need
to have their scroll state updated.
(WebCore::updateScrollInfoAfterLayoutTransactionStack): Added; returns the global stack of transactions.
(WebCore::RenderBlock::willBeDestroyed): Call removeFromUpdateScrollInfoAfterLayoutTransaction(), which
was formerly named as removeFromDelayedUpdateScrollInfoSet.
(WebCore::currentUpdateScrollInfoAfterLayoutTransaction): Added; returns the top-most transaction in the
global stack.
(WebCore::RenderBlock::beginUpdateScrollInfoAfterLayoutTransaction): Modified as appropriate to make use
of the global stack of transactions; formerly named startDelayUpdateScrollInfo.
(WebCore::RenderBlock::endAndCommitUpdateScrollInfoAfterLayoutTransaction): Modified as appropriate to
make use of the global stack of transactions; formerly named finishDelayUpdateScrollInfo.
(WebCore::RenderBlock::removeFromUpdateScrollInfoAfterLayoutTransaction): Modified as appropriate to make
use of the global stack of transactions; formerly named removeFromDelayedUpdateScrollInfoSet.
(WebCore::RenderBlock::updateScrollInfoAfterLayout): Modified as appropriate to make use of the global
stack of transactions.
(WebCore::RenderBlock::layout): Ditto.
(WebCore::RenderBlock::startDelayUpdateScrollInfo): Deleted.
(WebCore::RenderBlock::finishDelayUpdateScrollInfo): Deleted.
(WebCore::RenderBlock::removeFromDelayedUpdateScrollInfoSet): Deleted.
* rendering/RenderBlock.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::willBeDestroyed): Call removeFromUpdateScrollInfoAfterLayoutTransaction(), which
was formerly named removeFromDelayedUpdateScrollInfoSet.
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox): Call {begin, end}UpdateScrollInfoAfterLayoutTransaction(),
which was formerly named {start, end}DelayUpdateScrollInfo.
(WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox): Ditto.
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock): Ditto.

LayoutTests:
Added tests to ensure that that we update the scroll state of an element during the layout phase of its
associated RenderView.

* fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-and-needs-full-repaint-crash-expected.txt: Added.
* fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-and-needs-full-repaint-crash.html: Added.
* fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-assertion-failure-expected.txt: Added.
* fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-assertion-failure.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (169127 => 169128)


--- trunk/LayoutTests/ChangeLog	2014-05-20 20:21:23 UTC (rev 169127)
+++ trunk/LayoutTests/ChangeLog	2014-05-20 20:34:35 UTC (rev 169128)
@@ -1,3 +1,19 @@
+2014-05-20  Daniel Bates  <[email protected]>
+
+        Element within flattened frame may update its scroll state during the layout phase of the wrong RenderView
+        https://bugs.webkit.org/show_bug.cgi?id=133013
+        <rdar://problem/16760154>
+
+        Reviewed by David Hyatt.
+
+        Added tests to ensure that that we update the scroll state of an element during the layout phase of its
+        associated RenderView.
+
+        * fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-and-needs-full-repaint-crash-expected.txt: Added.
+        * fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-and-needs-full-repaint-crash.html: Added.
+        * fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-assertion-failure-expected.txt: Added.
+        * fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-assertion-failure.html: Added.
+
 2014-05-19  Mark Hahnenberg  <[email protected]>
 
         JSArray::shiftCountWith* could be more efficient

Added: trunk/LayoutTests/fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-and-needs-full-repaint-crash-expected.txt (0 => 169128)


--- trunk/LayoutTests/fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-and-needs-full-repaint-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-and-needs-full-repaint-crash-expected.txt	2014-05-20 20:34:35 UTC (rev 169128)
@@ -0,0 +1,4 @@
+This tests that we don't cause a crash when performing a full repaint of an <iframe> with zero height, enclosed in a flex box, whose content document contains a flex box with a child scrollable <div>.
+
+
+PASS

Added: trunk/LayoutTests/fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-and-needs-full-repaint-crash.html (0 => 169128)


--- trunk/LayoutTests/fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-and-needs-full-repaint-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-and-needs-full-repaint-crash.html	2014-05-20 20:34:35 UTC (rev 169128)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+if (window.internals)
+    internals.settings.setFrameFlatteningEnabled(true);
+
+function done()
+{
+    document.getElementById("console").innerText = "PASS";
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+</script>
+</head>
+<body>
+<p>This tests that we don't cause a crash when performing a full repaint of an &lt;iframe&gt; with zero height, enclosed in a flex box, whose content document contains a flex box with a child scrollable &lt;div&gt;.</p>
+<div id="test-container" style="display: -webkit-flex; -webkit-flex-direction: column; height: 512px;">
+    <iframe style="width: 100%; overflow: hidden" height="0" srcdoc="
+        <div style='display: -webkit-flex; -webkit-flex-direction: column; height: 128px; width: 128px; background-color: blue'>
+            <div id='scrollableDiv' style='overflow-y: scroll; outline: none; width: 10px; height: 10px; -webkit-flex: 1;'>
+                <br><br><br><br><br><br><br><br><br>Lorem ipsum
+            </div>
+        </div>
+        <script>
+        document.getElementById('scrollableDiv').scrollTop = 108;
+        window.parent.done();
+        </script>
+    "></iframe>
+</div>
+<pre id="console">FAIL</pre>
+</body>
+</html>

Added: trunk/LayoutTests/fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-assertion-failure-expected.txt (0 => 169128)


--- trunk/LayoutTests/fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-assertion-failure-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-assertion-failure-expected.txt	2014-05-20 20:34:35 UTC (rev 169128)
@@ -0,0 +1,4 @@
+This tests that we don't cause an assertion failure when performing a partial repaint of an <iframe> with zero height, enclosed in a flex box, whose content document contains a flex box with a child scrollable <div>.
+
+
+PASS

Added: trunk/LayoutTests/fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-assertion-failure.html (0 => 169128)


--- trunk/LayoutTests/fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-assertion-failure.html	                        (rev 0)
+++ trunk/LayoutTests/fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-assertion-failure.html	2014-05-20 20:34:35 UTC (rev 169128)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+if (window.internals)
+    internals.settings.setFrameFlatteningEnabled(true);
+
+function done()
+{
+    document.getElementById("console").innerText = "PASS";
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+</script>
+</head>
+<body>
+<p>This tests that we don't cause an assertion failure when performing a partial repaint of an &lt;iframe&gt; with zero height, enclosed in a flex box, whose content document contains a flex box with a child scrollable &lt;div&gt;.</p>
+<div id="test-container" style="display: -webkit-flex; -webkit-flex-direction: column; height: 512px;">
+    <iframe style="width: 100%; overflow: hidden" height="0" srcdoc="
+        <div style='display: -webkit-flex; -webkit-flex-direction: column; height: 128px; width: 128px; background-color: blue'>
+            <div id='scrollableDiv' style='display: none; overflow-y: scroll; width: 100px;'></div>
+        </div>
+        <script>
+        window.setTimeout(function () {
+            var scrollableDiv = document.getElementById('scrollableDiv');
+            scrollableDiv.innerHTML = 'Supercalifragilisticexpialidocious'; /* A string that cannot be word-wrapped and exceeds the width of the scrollableDiv. */
+            scrollableDiv.style.display = 'block';
+            window.parent.done();
+        }, 0);
+        </script>
+    "></iframe>
+</div>
+<pre id="console">FAIL</pre>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (169127 => 169128)


--- trunk/Source/WebCore/ChangeLog	2014-05-20 20:21:23 UTC (rev 169127)
+++ trunk/Source/WebCore/ChangeLog	2014-05-20 20:34:35 UTC (rev 169128)
@@ -1,3 +1,59 @@
+2014-05-20  Daniel Bates  <[email protected]>
+
+        Element within flattened frame may update its scroll state during the layout phase of the wrong RenderView
+        https://bugs.webkit.org/show_bug.cgi?id=133013
+        <rdar://problem/16760154>
+
+        Reviewed by David Hyatt.
+
+        Fixes an issue where the scroll state of an element may be updated during the layout of the wrong
+        RenderView. In particular, the scroll state of an element inside a CSS flex box in a flattened
+        frame f is updated during the layout of the RenderView associated with the parent frame of f instead
+        of during the layout of the RenderView associated with f.
+
+        The layout machinery assumes that the scroll state of each scrollable element is updated before the
+        completion of layout for its associated RenderView. Currently we have logic to defer updating the scroll
+        state of a scrollable element until completion of recursive layout. For a page with a flattened frame, we
+        defer such updates until completion of layout for all RenderViews along the ancestor frame hierarchy of
+        each flattened frame regardless of the RenderView associated with the element that originated the
+        deferred scroll state request. Instead, only the RenderView associated with the element that deferred its
+        scroll state update should dispatch the scroll state update.
+
+        Tests: fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-and-needs-full-repaint-crash.html
+               fast/frames/flattening/scrollable-flexbox-inside-iframe-with-zero-height-assertion-failure.html
+
+        * rendering/RenderBlock.cpp: Removed WTF::-prefix in typedef definition for ContinuationOutlineTableMap.
+        (WebCore::UpdateScrollInfoAfterLayoutTransaction::UpdateScrollInfoAfterLayoutTransaction): Added; a struct
+        that represents a RenderView v, nested transaction count, and a list of RenderBlocks in v that will need
+        to have their scroll state updated.
+        (WebCore::updateScrollInfoAfterLayoutTransactionStack): Added; returns the global stack of transactions.
+        (WebCore::RenderBlock::willBeDestroyed): Call removeFromUpdateScrollInfoAfterLayoutTransaction(), which
+        was formerly named as removeFromDelayedUpdateScrollInfoSet.
+        (WebCore::currentUpdateScrollInfoAfterLayoutTransaction): Added; returns the top-most transaction in the
+        global stack.
+        (WebCore::RenderBlock::beginUpdateScrollInfoAfterLayoutTransaction): Modified as appropriate to make use
+        of the global stack of transactions; formerly named startDelayUpdateScrollInfo.
+        (WebCore::RenderBlock::endAndCommitUpdateScrollInfoAfterLayoutTransaction): Modified as appropriate to
+        make use of the global stack of transactions; formerly named finishDelayUpdateScrollInfo.
+        (WebCore::RenderBlock::removeFromUpdateScrollInfoAfterLayoutTransaction): Modified as appropriate to make
+        use of the global stack of transactions; formerly named removeFromDelayedUpdateScrollInfoSet.
+        (WebCore::RenderBlock::updateScrollInfoAfterLayout): Modified as appropriate to make use of the global
+        stack of transactions.
+        (WebCore::RenderBlock::layout): Ditto.
+        (WebCore::RenderBlock::startDelayUpdateScrollInfo): Deleted.
+        (WebCore::RenderBlock::finishDelayUpdateScrollInfo): Deleted.
+        (WebCore::RenderBlock::removeFromDelayedUpdateScrollInfoSet): Deleted.
+        * rendering/RenderBlock.h:
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::willBeDestroyed): Call removeFromUpdateScrollInfoAfterLayoutTransaction(), which
+        was formerly named removeFromDelayedUpdateScrollInfoSet.
+        * rendering/RenderDeprecatedFlexibleBox.cpp:
+        (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox): Call {begin, end}UpdateScrollInfoAfterLayoutTransaction(),
+        which was formerly named {start, end}DelayUpdateScrollInfo.
+        (WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox): Ditto.
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::layoutBlock): Ditto.
+
 2014-05-20  Beth Dakin  <[email protected]>
 
         REGRESSION (r169065): Mountain Lion run-api-tests failures: ASSERTION FAILED: 

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (169127 => 169128)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2014-05-20 20:21:23 UTC (rev 169127)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2014-05-20 20:34:35 UTC (rev 169128)
@@ -64,6 +64,7 @@
 #include "Settings.h"
 #include "ShadowRoot.h"
 #include "TransformState.h"
+#include <wtf/NeverDestroyed.h>
 #include <wtf/StackStats.h>
 #include <wtf/TemporaryChange.h>
 
@@ -90,12 +91,27 @@
 static TrackedContainerMap* gPositionedContainerMap = 0;
 static TrackedContainerMap* gPercentHeightContainerMap = 0;
     
-typedef WTF::HashMap<RenderBlock*, std::unique_ptr<ListHashSet<RenderInline*>>> ContinuationOutlineTableMap;
+typedef HashMap<RenderBlock*, std::unique_ptr<ListHashSet<RenderInline*>>> ContinuationOutlineTableMap;
 
-typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet;
-static int gDelayUpdateScrollInfo = 0;
-static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0;
+struct UpdateScrollInfoAfterLayoutTransaction {
+    UpdateScrollInfoAfterLayoutTransaction(const RenderView& view)
+        : nestedCount(0)
+        , view(&view)
+    {
+    }
 
+    int nestedCount;
+    const RenderView* view;
+    HashSet<RenderBlock*> blocks;
+};
+
+typedef Vector<UpdateScrollInfoAfterLayoutTransaction> DelayedUpdateScrollInfoStack;
+static std::unique_ptr<DelayedUpdateScrollInfoStack>& updateScrollInfoAfterLayoutTransactionStack()
+{
+    static NeverDestroyed<std::unique_ptr<DelayedUpdateScrollInfoStack>> delayedUpdatedScrollInfoStack;
+    return delayedUpdatedScrollInfoStack;
+}
+
 // Allocated only when some of these fields have non-default values
 
 struct RenderBlockRareData {
@@ -236,7 +252,7 @@
             parent()->dirtyLinesFromChangedChild(this);
     }
 
-    removeFromDelayedUpdateScrollInfoSet();
+    removeFromUpdateScrollInfoAfterLayoutTransaction();
 
     RenderBox::willBeDestroyed();
 }
@@ -919,40 +935,56 @@
     return false;
 }
 
-void RenderBlock::startDelayUpdateScrollInfo()
+static inline UpdateScrollInfoAfterLayoutTransaction* currentUpdateScrollInfoAfterLayoutTransaction()
 {
-    if (gDelayUpdateScrollInfo == 0) {
-        ASSERT(!gDelayedUpdateScrollInfoSet);
-        gDelayedUpdateScrollInfoSet = new DelayedUpdateScrollInfoSet;
-    }
-    ASSERT(gDelayedUpdateScrollInfoSet);
-    ++gDelayUpdateScrollInfo;
+    if (!updateScrollInfoAfterLayoutTransactionStack())
+        return nullptr;
+    return &updateScrollInfoAfterLayoutTransactionStack()->last();
 }
 
-void RenderBlock::finishDelayUpdateScrollInfo()
+void RenderBlock::beginUpdateScrollInfoAfterLayoutTransaction()
 {
-    --gDelayUpdateScrollInfo;
-    ASSERT(gDelayUpdateScrollInfo >= 0);
-    if (gDelayUpdateScrollInfo == 0) {
-        ASSERT(gDelayedUpdateScrollInfoSet);
+    if (!updateScrollInfoAfterLayoutTransactionStack())
+        updateScrollInfoAfterLayoutTransactionStack() = std::make_unique<DelayedUpdateScrollInfoStack>();
+    if (updateScrollInfoAfterLayoutTransactionStack()->isEmpty() || currentUpdateScrollInfoAfterLayoutTransaction()->view != &view())
+        updateScrollInfoAfterLayoutTransactionStack()->append(UpdateScrollInfoAfterLayoutTransaction(view()));
+    ++currentUpdateScrollInfoAfterLayoutTransaction()->nestedCount;
+}
 
-        std::unique_ptr<DelayedUpdateScrollInfoSet> infoSet(gDelayedUpdateScrollInfoSet);
-        gDelayedUpdateScrollInfoSet = 0;
+void RenderBlock::endAndCommitUpdateScrollInfoAfterLayoutTransaction()
+{
+    UpdateScrollInfoAfterLayoutTransaction* transaction = currentUpdateScrollInfoAfterLayoutTransaction();
+    ASSERT(transaction);
+    ASSERT(transaction->view == &view());
+    if (--transaction->nestedCount)
+        return;
 
-        for (DelayedUpdateScrollInfoSet::iterator it = infoSet->begin(); it != infoSet->end(); ++it) {
-            RenderBlock* block = *it;
-            if (block->hasOverflowClip()) {
-                block->layer()->updateScrollInfoAfterLayout();
-                block->clearLayoutOverflow();
-            }
-        }
+    // Calling RenderLayer::updateScrollInfoAfterLayout() may cause its associated block to layout again and
+    // updates its scroll info (i.e. call RenderBlock::updateScrollInfoAfterLayout()). We remove |transaction|
+    // from the transaction stack to ensure that all subsequent calls to RenderBlock::updateScrollInfoAfterLayout()
+    // are dispatched immediately. That is, to ensure that such subsequent calls aren't added to |transaction|
+    // while we are processing it.
+    Vector<RenderBlock*> blocksToUpdate;
+    copyToVector(transaction->blocks, blocksToUpdate);
+    updateScrollInfoAfterLayoutTransactionStack()->removeLast();
+    if (updateScrollInfoAfterLayoutTransactionStack()->isEmpty())
+        updateScrollInfoAfterLayoutTransactionStack() = nullptr;
+
+    for (auto* block : blocksToUpdate) {
+        ASSERT(block->hasOverflowClip());
+        block->layer()->updateScrollInfoAfterLayout();
+        block->clearLayoutOverflow();
     }
 }
 
-void RenderBlock::removeFromDelayedUpdateScrollInfoSet()
+void RenderBlock::removeFromUpdateScrollInfoAfterLayoutTransaction()
 {
-    if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0))
-        gDelayedUpdateScrollInfoSet->remove(this);
+    if (UNLIKELY(updateScrollInfoAfterLayoutTransactionStack().get() != 0)) {
+        UpdateScrollInfoAfterLayoutTransaction* transaction = currentUpdateScrollInfoAfterLayoutTransaction();
+        ASSERT(transaction);
+        ASSERT(transaction->view == &view());
+        transaction->blocks.remove(this);
+    }
 }
 
 void RenderBlock::updateScrollInfoAfterLayout()
@@ -967,10 +999,12 @@
             return;
         }
 
-        if (gDelayUpdateScrollInfo)
-            gDelayedUpdateScrollInfoSet->add(this);
-        else
-            layer()->updateScrollInfoAfterLayout();
+        UpdateScrollInfoAfterLayoutTransaction* transaction = currentUpdateScrollInfoAfterLayoutTransaction();
+        if (transaction && transaction->view == &view()) {
+            transaction->blocks.add(this);
+            return;
+        }
+        layer()->updateScrollInfoAfterLayout();
     }
 }
 
@@ -988,7 +1022,9 @@
     
     // It's safe to check for control clip here, since controls can never be table cells.
     // If we have a lightweight clip, there can never be any overflow from children.
-    if (hasControlClip() && m_overflow && !gDelayUpdateScrollInfo)
+    UpdateScrollInfoAfterLayoutTransaction* transaction = currentUpdateScrollInfoAfterLayoutTransaction();
+    bool isDelayingUpdateScrollInfoAfterLayoutInView = transaction && transaction->view == &view();
+    if (hasControlClip() && m_overflow && !isDelayingUpdateScrollInfoAfterLayoutInView)
         clearLayoutOverflow();
 
     invalidateBackgroundObscurationStatus();

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (169127 => 169128)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2014-05-20 20:21:23 UTC (rev 169127)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2014-05-20 20:34:35 UTC (rev 169128)
@@ -345,16 +345,15 @@
     virtual int firstLineBaseline() const override;
     virtual int inlineBlockBaseline(LineDirectionMode) const override;
 
-    // Delay update scrollbar until finishDelayRepaint() will be
-    // called. This function is used when a flexbox is laying out its
-    // descendant. If multiple calls are made to startDelayRepaint(),
-    // finishDelayRepaint() will do nothing until finishDelayRepaint()
-    // is called the same number of times.
-    static void startDelayUpdateScrollInfo();
-    static void finishDelayUpdateScrollInfo();
+    // Delay updating scrollbars until endAndCommitUpdateScrollInfoAfterLayoutTransaction() is called. These functions are used
+    // when a flexbox is laying out its descendants. If multiple calls are made to beginUpdateScrollInfoAfterLayoutTransaction()
+    // then endAndCommitUpdateScrollInfoAfterLayoutTransaction() will do nothing until it is called the same number of times.
+    void beginUpdateScrollInfoAfterLayoutTransaction();
+    void endAndCommitUpdateScrollInfoAfterLayoutTransaction();
 
+    void removeFromUpdateScrollInfoAfterLayoutTransaction();
+
     void updateScrollInfoAfterLayout();
-    void removeFromDelayedUpdateScrollInfoSet();
 
     virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) override;
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (169127 => 169128)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2014-05-20 20:21:23 UTC (rev 169127)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2014-05-20 20:34:35 UTC (rev 169128)
@@ -182,7 +182,7 @@
 
     m_lineBoxes.deleteLineBoxes();
 
-    removeFromDelayedUpdateScrollInfoSet();
+    removeFromUpdateScrollInfoAfterLayoutTransaction();
 
     // NOTE: This jumps down to RenderBox, bypassing RenderBlock since it would do duplicate work.
     RenderBox::willBeDestroyed();

Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (169127 => 169128)


--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2014-05-20 20:21:23 UTC (rev 169127)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2014-05-20 20:34:35 UTC (rev 169128)
@@ -391,7 +391,7 @@
     bool haveFlex = false, flexingChildren = false; 
     gatherFlexChildrenInfo(iterator, relayoutChildren, highestFlexGroup, lowestFlexGroup, haveFlex);
 
-    RenderBlock::startDelayUpdateScrollInfo();
+    beginUpdateScrollInfoAfterLayoutTransaction();
 
     ChildLayoutDeltas childLayoutDeltas;
     appendChildLayoutDeltas(this, childLayoutDeltas);
@@ -621,7 +621,7 @@
         }
     } while (haveFlex);
 
-    RenderBlock::finishDelayUpdateScrollInfo();
+    endAndCommitUpdateScrollInfoAfterLayoutTransaction();
 
     if (remainingSpace > 0 && ((style().isLeftToRightDirection() && style().boxPack() != Start)
         || (!style().isLeftToRightDirection() && style().boxPack() != End))) {
@@ -698,7 +698,7 @@
     if (haveLineClamp)
         applyLineClamp(iterator, relayoutChildren);
 
-    RenderBlock::startDelayUpdateScrollInfo();
+    beginUpdateScrollInfoAfterLayoutTransaction();
 
     ChildLayoutDeltas childLayoutDeltas;
     appendChildLayoutDeltas(this, childLayoutDeltas);
@@ -879,7 +879,7 @@
         }
     } while (haveFlex);
 
-    RenderBlock::finishDelayUpdateScrollInfo();
+    endAndCommitUpdateScrollInfoAfterLayoutTransaction();
 
     if (style().boxPack() != Start && remainingSpace > 0) {
         // Children must be repositioned.

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (169127 => 169128)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2014-05-20 20:21:23 UTC (rev 169127)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2014-05-20 20:34:35 UTC (rev 169128)
@@ -271,7 +271,7 @@
 
     m_numberOfInFlowChildrenOnFirstLine = -1;
 
-    RenderBlock::startDelayUpdateScrollInfo();
+    beginUpdateScrollInfoAfterLayoutTransaction();
 
     dirtyForLayoutFromPercentageHeightDescendants();
 
@@ -287,7 +287,7 @@
     updateLogicalHeight();
     repositionLogicalHeightDependentFlexItems(lineContexts);
 
-    RenderBlock::finishDelayUpdateScrollInfo();
+    endAndCommitUpdateScrollInfoAfterLayoutTransaction();
 
     if (logicalHeight() != previousHeight)
         relayoutChildren = true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to