Index: Source/core/frame/FrameView.cpp |
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp |
index dc91f7916145ab9b990ce43a4089d7675ffb75bf..bdf389b57a826b00a117b84a4c13cc2e586dbe12 100644 |
--- a/Source/core/frame/FrameView.cpp |
+++ b/Source/core/frame/FrameView.cpp |
@@ -136,7 +136,7 @@ |
: m_frame(frame) |
, m_canHaveScrollbars(true) |
, m_slowRepaintObjectCount(0) |
- , m_hasPendingLayout(false) |
+ , m_layoutTimer(this, &FrameView::layoutTimerFired) |
, m_layoutSubtreeRoot(0) |
, m_inSynchronousPostLayout(false) |
, m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) |
@@ -220,7 +220,7 @@ |
m_cannotBlitToWindow = false; |
m_isOverlapped = false; |
m_contentIsOpaque = false; |
- m_hasPendingLayout = false; |
+ m_layoutTimer.stop(); |
m_layoutSubtreeRoot = 0; |
m_delayedLayout = false; |
m_doFullRepaint = true; |
@@ -909,7 +909,7 @@ |
// Every scroll that happens during layout is programmatic. |
TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true); |
- m_hasPendingLayout = false; |
+ m_layoutTimer.stop(); |
m_delayedLayout = false; |
// we shouldn't enter layout() while painting |
@@ -1761,6 +1761,11 @@ |
autoSizeIfEnabled(); |
} |
+void FrameView::layoutTimerFired(Timer<FrameView>*) |
+{ |
+ layout(); |
+} |
+ |
void FrameView::scheduleRelayout() |
{ |
ASSERT(m_frame->view() == this); |
@@ -1778,14 +1783,13 @@ |
InspectorInstrumentation::didInvalidateLayout(m_frame.get()); |
int delay = m_frame->document()->minimumLayoutDelay(); |
- if (m_hasPendingLayout && m_delayedLayout && !delay) |
+ if (m_layoutTimer.isActive() && m_delayedLayout && !delay) |
unscheduleRelayout(); |
- if (m_hasPendingLayout) |
+ if (m_layoutTimer.isActive()) |
return; |
m_delayedLayout = delay != 0; |
- m_hasPendingLayout = true; |
- scheduleAnimation(); |
+ m_layoutTimer.startOneShot(delay * 0.001); |
} |
static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* descendant) |
@@ -1835,14 +1839,13 @@ |
ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->container()->needsLayout()); |
InspectorInstrumentation::didInvalidateLayout(m_frame.get()); |
m_delayedLayout = delay != 0; |
- m_hasPendingLayout = true; |
- scheduleAnimation(); |
+ m_layoutTimer.startOneShot(delay * 0.001); |
} |
} |
bool FrameView::layoutPending() const |
{ |
- return m_hasPendingLayout; |
+ return m_layoutTimer.isActive(); |
} |
bool FrameView::needsLayout() const |
@@ -1865,10 +1868,10 @@ |
void FrameView::unscheduleRelayout() |
{ |
- if (!m_hasPendingLayout) |
- return; |
- |
- m_hasPendingLayout = false; |
+ if (!m_layoutTimer.isActive()) |
+ return; |
+ |
+ m_layoutTimer.stop(); |
m_delayedLayout = false; |
} |