- Revision
- 216001
- Author
- [email protected]
- Date
- 2017-04-30 17:15:38 -0700 (Sun, 30 Apr 2017)
Log Message
Initialize a new layout state while bailing out of simple line layout only when needed.
https://bugs.webkit.org/show_bug.cgi?id=171481
<rdar://problem/31906382>
Source/WebCore:
'-webkit-border-fit: lines' requires inline box tree.
We normally bail out of simple line layout early when we see this property.
When this property is dynamically set and we already have a simple line layout context,
RenderBlockFlow::ensureLineBoxes() takes care of the switch by calling layoutLineBoxes().
This patch makes sure that we create the layout state for this (forced)line layout only when
we don't yet have one.
Reviewed by Antti Koivisto.
Test: fast/multicol/simple-line-layout-switch-to-normal-layout-while-inside-layout.html
* rendering/RenderBlockFlow.cpp:
(WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer):
(WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer):
(WebCore::RenderBlockFlow::ensureLineBoxes):
* rendering/RenderView.cpp:
(WebCore::RenderView::pushLayoutStateForPaginationIfNeeded):
(WebCore::RenderView::pushLayoutStateForPagination): Deleted.
* rendering/RenderView.h:
LayoutTests:
Reviewed by Antti Koivisto.
* fast/multicol/simple-line-layout-switch-to-normal-layout-while-inside-layout-expected.txt: Added.
* fast/multicol/simple-line-layout-switch-to-normal-layout-while-inside-layout.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (216000 => 216001)
--- trunk/LayoutTests/ChangeLog 2017-04-30 23:39:51 UTC (rev 216000)
+++ trunk/LayoutTests/ChangeLog 2017-05-01 00:15:38 UTC (rev 216001)
@@ -1,3 +1,14 @@
+2017-04-30 Zalan Bujtas <[email protected]>
+
+ Initialize a new layout state while bailing out of simple line layout only when needed.
+ https://bugs.webkit.org/show_bug.cgi?id=171481
+ <rdar://problem/31906382>
+
+ Reviewed by Antti Koivisto.
+
+ * fast/multicol/simple-line-layout-switch-to-normal-layout-while-inside-layout-expected.txt: Added.
+ * fast/multicol/simple-line-layout-switch-to-normal-layout-while-inside-layout.html: Added.
+
2017-04-30 Joanmarie Diggs <[email protected]>
[ATK] Implement support for aria-autocomplete
Added: trunk/LayoutTests/fast/multicol/simple-line-layout-switch-to-normal-layout-while-inside-layout-expected.txt (0 => 216001)
--- trunk/LayoutTests/fast/multicol/simple-line-layout-switch-to-normal-layout-while-inside-layout-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/multicol/simple-line-layout-switch-to-normal-layout-while-inside-layout-expected.txt 2017-05-01 00:15:38 UTC (rev 216001)
@@ -0,0 +1,2 @@
+Pass if no crash or assert
+
Added: trunk/LayoutTests/fast/multicol/simple-line-layout-switch-to-normal-layout-while-inside-layout.html (0 => 216001)
--- trunk/LayoutTests/fast/multicol/simple-line-layout-switch-to-normal-layout-while-inside-layout.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/simple-line-layout-switch-to-normal-layout-while-inside-layout.html 2017-05-01 00:15:38 UTC (rev 216001)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we can properly bail out of simple line layout while inside layout.</title>
+<style>
+.foo {
+ -webkit-border-fit: lines;
+ column-count: 2;
+}
+</style>
+</head>
+<body>
+<div id=foobar>Pass if no crash or assert<div></div></div>
+<script>
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+setTimeout(function() {
+ foobar.className = "foo";
+ if (window.testRunner)
+ testRunner.notifyDone();
+}, 0);
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (216000 => 216001)
--- trunk/Source/WebCore/ChangeLog 2017-04-30 23:39:51 UTC (rev 216000)
+++ trunk/Source/WebCore/ChangeLog 2017-05-01 00:15:38 UTC (rev 216001)
@@ -1,3 +1,29 @@
+2017-04-30 Zalan Bujtas <[email protected]>
+
+ Initialize a new layout state while bailing out of simple line layout only when needed.
+ https://bugs.webkit.org/show_bug.cgi?id=171481
+ <rdar://problem/31906382>
+
+ '-webkit-border-fit: lines' requires inline box tree.
+ We normally bail out of simple line layout early when we see this property.
+ When this property is dynamically set and we already have a simple line layout context,
+ RenderBlockFlow::ensureLineBoxes() takes care of the switch by calling layoutLineBoxes().
+ This patch makes sure that we create the layout state for this (forced)line layout only when
+ we don't yet have one.
+
+ Reviewed by Antti Koivisto.
+
+ Test: fast/multicol/simple-line-layout-switch-to-normal-layout-while-inside-layout.html
+
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer):
+ (WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer):
+ (WebCore::RenderBlockFlow::ensureLineBoxes):
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::pushLayoutStateForPaginationIfNeeded):
+ (WebCore::RenderView::pushLayoutStateForPagination): Deleted.
+ * rendering/RenderView.h:
+
2017-04-30 Dan Bernstein <[email protected]>
Tried to fix the iOS build after r215992
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (216000 => 216001)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2017-04-30 23:39:51 UTC (rev 216000)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2017-05-01 00:15:38 UTC (rev 216001)
@@ -68,6 +68,25 @@
COMPILE_ASSERT(sizeof(RenderBlockFlow::MarginValues) == sizeof(LayoutUnit[4]), MarginValues_should_stay_small);
COMPILE_ASSERT(sizeof(RenderBlockFlow::MarginInfo) == sizeof(SameSizeAsMarginInfo), MarginInfo_should_stay_small);
+class PaginatedLayoutStateMaintainer {
+public:
+ PaginatedLayoutStateMaintainer(RenderBlockFlow& flow)
+ : m_flow(flow)
+ , m_pushed(flow.view().pushLayoutStateForPaginationIfNeeded(flow))
+ {
+ }
+
+ ~PaginatedLayoutStateMaintainer()
+ {
+ if (m_pushed)
+ m_flow.view().popLayoutState(m_flow);
+ }
+
+private:
+ RenderBlockFlow& m_flow;
+ bool m_pushed { false };
+};
+
// Our MarginInfo state used when laying out block children.
RenderBlockFlow::MarginInfo::MarginInfo(const RenderBlockFlow& block, LayoutUnit beforeBorderPadding, LayoutUnit afterBorderPadding)
: m_atBeforeSideOfBlock(true)
@@ -3731,12 +3750,11 @@
LayoutUnit repaintLogicalTop;
LayoutUnit repaintLogicalBottom;
if (isPaginated) {
- view().pushLayoutStateForPagination(*this);
+ PaginatedLayoutStateMaintainer state(*this);
layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
// This matches relayoutToAvoidWidows.
if (shouldBreakAtLineToAvoidWidow())
layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
- view().popLayoutState(*this);
} else
layoutLineBoxes(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (216000 => 216001)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2017-04-30 23:39:51 UTC (rev 216000)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2017-05-01 00:15:38 UTC (rev 216001)
@@ -1233,14 +1233,16 @@
pushLayoutStateForCurrentFlowThread(root);
}
-void RenderView::pushLayoutStateForPagination(RenderBlockFlow& layoutRoot)
+bool RenderView::pushLayoutStateForPaginationIfNeeded(RenderBlockFlow& layoutRoot)
{
- ASSERT(!m_layoutState);
+ if (m_layoutState)
+ return false;
m_layoutState = std::make_unique<LayoutState>(layoutRoot);
m_layoutState->m_isPaginated = true;
// This is just a flag for known page height (see RenderBlockFlow::checkForPaginationLogicalHeightChange).
m_layoutState->m_pageLogicalHeight = 1;
pushLayoutStateForCurrentFlowThread(layoutRoot);
+ return true;
}
IntSize RenderView::viewportSizeForCSSViewportUnits() const
Modified: trunk/Source/WebCore/rendering/RenderView.h (216000 => 216001)
--- trunk/Source/WebCore/rendering/RenderView.h 2017-04-30 23:39:51 UTC (rev 216000)
+++ trunk/Source/WebCore/rendering/RenderView.h 2017-05-01 00:15:38 UTC (rev 216001)
@@ -132,7 +132,7 @@
// Subtree push/pop
void pushLayoutState(RenderObject&);
- void pushLayoutStateForPagination(RenderBlockFlow&);
+ bool pushLayoutStateForPaginationIfNeeded(RenderBlockFlow&);
void popLayoutState(RenderObject&) { return popLayoutState(); } // Just doing this to keep popLayoutState() private and to make the subtree calls symmetrical.
// Returns true if layoutState should be used for its cached offset and clip.