- Revision
- 132105
- Author
- e...@chromium.org
- Date
- 2012-10-22 10:46:50 -0700 (Mon, 22 Oct 2012)
Log Message
Modify LayoutState ASSERTS to support SATURATED_LAYOUT_ARITHMETIC
https://bugs.webkit.org/show_bug.cgi?id=98692
Reviewed by Dan Bernstein.
We currently overflow/wrap when computing the delta in
RenderBlock::setLogicalTopForChild in cases where we have an
element with a width or height exceeding maxLayoutUnit. When
the delta is later added back in RenderBlock::layoutBlockChild
the number wraps again getting us back to the correct value.
With SATURATED_LAYOUT_ARITHMETIC enabled the values no longer
wraps, which seems like the correct thing to do however this
causes the compare to fail for obvious reasons. By accounting
for this we can keep the asserts (which have proven very
helpful) even when SATURATED_LAYOUT_ARITHMETIC is turned on.
No new tests, covered by existing tests.
* rendering/LayoutState.cpp:
(WebCore::LayoutState::LayoutState):
* rendering/LayoutState.h:
(WebCore::LayoutState::LayoutState):
(LayoutState):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layoutBlockChild):
* rendering/RenderView.cpp:
(WebCore::RenderView::layout):
* rendering/RenderView.h:
(WebCore::RenderView::addLayoutDelta):
(RenderView):
(WebCore::RenderView::layoutDeltaMatches):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (132104 => 132105)
--- trunk/Source/WebCore/ChangeLog 2012-10-22 17:45:33 UTC (rev 132104)
+++ trunk/Source/WebCore/ChangeLog 2012-10-22 17:46:50 UTC (rev 132105)
@@ -1,3 +1,38 @@
+2012-10-22 Emil A Eklund <e...@chromium.org>
+
+ Modify LayoutState ASSERTS to support SATURATED_LAYOUT_ARITHMETIC
+ https://bugs.webkit.org/show_bug.cgi?id=98692
+
+ Reviewed by Dan Bernstein.
+
+ We currently overflow/wrap when computing the delta in
+ RenderBlock::setLogicalTopForChild in cases where we have an
+ element with a width or height exceeding maxLayoutUnit. When
+ the delta is later added back in RenderBlock::layoutBlockChild
+ the number wraps again getting us back to the correct value.
+
+ With SATURATED_LAYOUT_ARITHMETIC enabled the values no longer
+ wraps, which seems like the correct thing to do however this
+ causes the compare to fail for obvious reasons. By accounting
+ for this we can keep the asserts (which have proven very
+ helpful) even when SATURATED_LAYOUT_ARITHMETIC is turned on.
+
+ No new tests, covered by existing tests.
+
+ * rendering/LayoutState.cpp:
+ (WebCore::LayoutState::LayoutState):
+ * rendering/LayoutState.h:
+ (WebCore::LayoutState::LayoutState):
+ (LayoutState):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::layoutBlockChild):
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::layout):
+ * rendering/RenderView.h:
+ (WebCore::RenderView::addLayoutDelta):
+ (RenderView):
+ (WebCore::RenderView::layoutDeltaMatches):
+
2012-10-22 Tony Chang <t...@chromium.org>
Fix some baseline flexbox alignment
Modified: trunk/Source/WebCore/rendering/LayoutState.cpp (132104 => 132105)
--- trunk/Source/WebCore/rendering/LayoutState.cpp 2012-10-22 17:45:33 UTC (rev 132104)
+++ trunk/Source/WebCore/rendering/LayoutState.cpp 2012-10-22 17:46:50 UTC (rev 132105)
@@ -36,7 +36,12 @@
namespace WebCore {
LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSize& offset, LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged, ColumnInfo* columnInfo)
- : m_columnInfo(columnInfo)
+ : m_clipped(false)
+#if !ASSERT_DISABLED && ENABLE(SATURATED_LAYOUT_ARITHMETIC)
+ , m_layoutDeltaXSaturated(false)
+ , m_layoutDeltaYSaturated(false)
+#endif
+ , m_columnInfo(columnInfo)
, m_lineGrid(0)
, m_next(prev)
#ifndef NDEBUG
@@ -119,6 +124,10 @@
#endif
m_layoutDelta = m_next->m_layoutDelta;
+#if !ASSERT_DISABLED && ENABLE(SATURATED_LAYOUT_ARITHMETIC)
+ m_layoutDeltaXSaturated = m_next->m_layoutDeltaXSaturated;
+ m_layoutDeltaYSaturated = m_next->m_layoutDeltaYSaturated;
+#endif
m_isPaginated = m_pageLogicalHeight || m_columnInfo || renderer->isRenderFlowThread();
@@ -135,6 +144,10 @@
LayoutState::LayoutState(RenderObject* root)
: m_clipped(false)
, m_isPaginated(false)
+#if !ASSERT_DISABLED && ENABLE(SATURATED_LAYOUT_ARITHMETIC)
+ , m_layoutDeltaXSaturated(false)
+ , m_layoutDeltaYSaturated(false)
+#endif
, m_pageLogicalHeight(0)
, m_pageLogicalHeightChanged(false)
, m_columnInfo(0)
Modified: trunk/Source/WebCore/rendering/LayoutState.h (132104 => 132105)
--- trunk/Source/WebCore/rendering/LayoutState.h 2012-10-22 17:45:33 UTC (rev 132104)
+++ trunk/Source/WebCore/rendering/LayoutState.h 2012-10-22 17:46:50 UTC (rev 132105)
@@ -48,6 +48,10 @@
LayoutState()
: m_clipped(false)
, m_isPaginated(false)
+#if !ASSERT_DISABLED && ENABLE(SATURATED_LAYOUT_ARITHMETIC)
+ , m_layoutDeltaXSaturated(false)
+ , m_layoutDeltaYSaturated(false)
+#endif
, m_pageLogicalHeight(0)
, m_pageLogicalHeightChanged(false)
, m_columnInfo(0)
@@ -109,6 +113,10 @@
public:
bool m_clipped;
bool m_isPaginated;
+#if !ASSERT_DISABLED && ENABLE(SATURATED_LAYOUT_ARITHMETIC)
+ bool m_layoutDeltaXSaturated;
+ bool m_layoutDeltaYSaturated;
+#endif
LayoutRect m_clipRect;
// x/y offset from container. Includes relative positioning and scroll offsets.
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (132104 => 132105)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-10-22 17:45:33 UTC (rev 132104)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-10-22 17:46:50 UTC (rev 132105)
@@ -2567,7 +2567,7 @@
setLogicalHeight(newHeight);
}
- ASSERT(oldLayoutDelta == view()->layoutDelta());
+ ASSERT(view()->layoutDeltaMatches(oldLayoutDelta));
}
void RenderBlock::simplifiedNormalFlowLayout()
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (132104 => 132105)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2012-10-22 17:45:33 UTC (rev 132104)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2012-10-22 17:46:50 UTC (rev 132105)
@@ -148,7 +148,7 @@
#ifndef NDEBUG
void RenderView::checkLayoutState(const LayoutState& state)
{
- ASSERT(layoutDelta() == LayoutSize());
+ ASSERT(layoutDeltaMatches(LayoutSize()));
ASSERT(!m_layoutStateDisableCount);
ASSERT(m_layoutState == &state);
}
Modified: trunk/Source/WebCore/rendering/RenderView.h (132104 => 132105)
--- trunk/Source/WebCore/rendering/RenderView.h 2012-10-22 17:45:33 UTC (rev 132104)
+++ trunk/Source/WebCore/rendering/RenderView.h 2012-10-22 17:46:50 UTC (rev 132105)
@@ -124,9 +124,27 @@
}
void addLayoutDelta(const LayoutSize& delta)
{
- if (m_layoutState)
+ if (m_layoutState) {
m_layoutState->m_layoutDelta += delta;
+#if !ASSERT_DISABLED && ENABLE(SATURATED_LAYOUT_ARITHMETIC)
+ m_layoutState->m_layoutDeltaXSaturated |= m_layoutState->m_layoutDelta.width() == FractionalLayoutUnit::max() || m_layoutState->m_layoutDelta.width() == FractionalLayoutUnit::min();
+ m_layoutState->m_layoutDeltaYSaturated |= m_layoutState->m_layoutDelta.height() == FractionalLayoutUnit::max() || m_layoutState->m_layoutDelta.height() == FractionalLayoutUnit::min();
+#endif
+ }
}
+
+#if !ASSERT_DISABLED
+ bool layoutDeltaMatches(const LayoutSize& delta)
+ {
+ if (!m_layoutState)
+ return false;
+#if ENABLE(SATURATED_LAYOUT_ARITHMETIC)
+ return (delta.width() == m_layoutState->m_layoutDelta.width() || m_layoutState->m_layoutDeltaXSaturated) && (delta.height() == m_layoutState->m_layoutDelta.height() || m_layoutState->m_layoutDeltaYSaturated);
+#else
+ return delta == m_layoutState->m_layoutDelta;
+#endif
+ }
+#endif
bool doingFullRepaint() const { return m_frameView->needsFullRepaint(); }