Modified: trunk/Source/WebCore/ChangeLog (188484 => 188485)
--- trunk/Source/WebCore/ChangeLog 2015-08-14 20:07:15 UTC (rev 188484)
+++ trunk/Source/WebCore/ChangeLog 2015-08-14 20:27:58 UTC (rev 188485)
@@ -1,3 +1,23 @@
+2015-08-14 Zalan Bujtas <[email protected]>
+
+ RenderBlock::simplifiedLayout should pop LayoutStateMaintainer when early returns.
+ https://bugs.webkit.org/show_bug.cgi?id=148031
+
+ Reviewed by Simon Fraser.
+
+ LayoutStateMaintainer push/pop calls need to be balanced to ensure layout consistency.
+
+ Unable to make a test case for this.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::simplifiedLayout):
+ * rendering/RenderView.h:
+ (WebCore::LayoutStateMaintainer::~LayoutStateMaintainer): ASSERT the state properly.
+ (WebCore::LayoutStateMaintainer::push):
+ (WebCore::LayoutStateMaintainer::pop):
+ (WebCore::LayoutStateMaintainer::didPush):
+ (WebCore::LayoutStateMaintainer::LayoutStateMaintainer): Deleted.
+
2015-08-14 Simon Fraser <[email protected]>
Remove a few includes from RenderObject.h
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (188484 => 188485)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2015-08-14 20:07:15 UTC (rev 188484)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2015-08-14 20:27:58 UTC (rev 188485)
@@ -1205,9 +1205,10 @@
return false;
LayoutStateMaintainer statePusher(view(), *this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
-
- if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovementOnly())
+ if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovementOnly()) {
+ statePusher.pop();
return false;
+ }
// Lay out positioned descendants or objects that just need to recompute overflow.
if (needsSimplifiedNormalFlowLayout())
Modified: trunk/Source/WebCore/rendering/RenderView.h (188484 => 188485)
--- trunk/Source/WebCore/rendering/RenderView.h 2015-08-14 20:07:15 UTC (rev 188484)
+++ trunk/Source/WebCore/rendering/RenderView.h 2015-08-14 20:27:58 UTC (rev 188485)
@@ -387,9 +387,6 @@
explicit LayoutStateMaintainer(RenderView& view, RenderBox& root, LayoutSize offset, bool disableState = false, LayoutUnit pageHeight = 0, bool pageHeightChanged = false)
: m_view(view)
, m_disabled(disableState)
- , m_didStart(false)
- , m_didEnd(false)
- , m_didCreateLayoutState(false)
{
push(root, offset, pageHeight, pageHeightChanged);
}
@@ -397,50 +394,47 @@
// Constructor to maybe push later.
explicit LayoutStateMaintainer(RenderView& view)
: m_view(view)
- , m_disabled(false)
- , m_didStart(false)
- , m_didEnd(false)
- , m_didCreateLayoutState(false)
{
}
~LayoutStateMaintainer()
{
- ASSERT(m_didStart == m_didEnd); // if this fires, it means that someone did a push(), but forgot to pop().
+ ASSERT(!m_didCallPush || m_didCallPush == m_didCallPop);
}
void push(RenderBox& root, LayoutSize offset, LayoutUnit pageHeight = 0, bool pageHeightChanged = false)
{
- ASSERT(!m_didStart);
+ ASSERT(!m_didCallPush);
+ m_didCallPush = true;
// We push state even if disabled, because we still need to store layoutDelta
- m_didCreateLayoutState = m_view.pushLayoutState(root, offset, pageHeight, pageHeightChanged);
- if (m_disabled && m_didCreateLayoutState)
+ m_didPushLayoutState = m_view.pushLayoutState(root, offset, pageHeight, pageHeightChanged);
+ if (!m_didPushLayoutState)
+ return;
+ if (m_disabled)
m_view.disableLayoutState();
- m_didStart = true;
}
void pop()
{
- if (m_didStart) {
- ASSERT(!m_didEnd);
- if (m_didCreateLayoutState) {
- m_view.popLayoutState();
- if (m_disabled)
- m_view.enableLayoutState();
- }
-
- m_didEnd = true;
- }
+ ASSERT(!m_didCallPop);
+ m_didCallPop = true;
+ if (!m_didCallPush)
+ return;
+ if (!m_didPushLayoutState)
+ return;
+ m_view.popLayoutState();
+ if (m_disabled)
+ m_view.enableLayoutState();
}
- bool didPush() const { return m_didStart; }
+ bool didPush() const { return m_didCallPush; }
private:
RenderView& m_view;
- bool m_disabled : 1; // true if the offset and clip part of layoutState is disabled
- bool m_didStart : 1; // true if we did a push or disable
- bool m_didEnd : 1; // true if we popped or re-enabled
- bool m_didCreateLayoutState : 1; // true if we actually made a layout state.
+ bool m_disabled { false };
+ bool m_didCallPush { false };
+ bool m_didCallPop { false };
+ bool m_didPushLayoutState { false };
};
class LayoutStateDisabler {