Commit 7928011b authored by mstensho's avatar mstensho Committed by Commit bot

Add PageBoundaryRule parameter to columnSetAtBlockOffset().

If it's an exclusive end offset, we need to know this, so that we map to the
former column set, rather than the latter, if the offset is at a column set
boundary.

Review-Url: https://codereview.chromium.org/2340213003
Cr-Commit-Position: refs/heads/master@{#418839}
parent 8bf47bb4
<!DOCTYPE html> <!DOCTYPE html>
<script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/testharnessreport.js"></script>
<div style="position:relative; writing-mode:vertical-lr; columns:3; column-gap:10px; column-fill:auto; width:100px; height:320px;"> <div style="position:relative; writing-mode:vertical-lr; columns:3; column-gap:10px; height:320px;">
<div id="first" style="width:100px;"></div> <div id="first" style="width:100px;"></div>
<div id="second" style="width:100px;"></div> <div id="second" style="width:100px;"></div>
<div id="third" style="width:100px;"></div> <div id="third" style="width:100px;"></div>
<div id="spanner" style="column-span:all; width:50px;"></div>
<div id="fifth" style="width:100px;"></div>
<div id="sixth" style="width:100px;"></div>
<div id="seventh" style="width:100px;"></div>
</div> </div>
<script> <script>
test(function() { test(function() {
assert_equals(document.getElementById('first').offsetLeft, 0); assert_equals(document.getElementById('first').offsetLeft, 0);
...@@ -21,4 +26,24 @@ ...@@ -21,4 +26,24 @@
assert_equals(document.getElementById('third').offsetLeft, 0); assert_equals(document.getElementById('third').offsetLeft, 0);
assert_equals(document.getElementById('third').offsetTop, 220); assert_equals(document.getElementById('third').offsetTop, 220);
}, "offsetLeft and offsetTop in vertical-lr at column boundaries, third element"); }, "offsetLeft and offsetTop in vertical-lr at column boundaries, third element");
test(function() {
assert_equals(document.getElementById('spanner').offsetLeft, 100);
assert_equals(document.getElementById('spanner').offsetTop, 0);
}, "offsetLeft and offsetTop in vertical-lr, spanner");
test(function() {
assert_equals(document.getElementById('fifth').offsetLeft, 150);
assert_equals(document.getElementById('fifth').offsetTop, 0);
}, "offsetLeft and offsetTop in vertical-lr at column boundaries, fifth element");
test(function() {
assert_equals(document.getElementById('sixth').offsetLeft, 150);
assert_equals(document.getElementById('sixth').offsetTop, 110);
}, "offsetLeft and offsetTop in vertical-lr at column boundaries, sixth element");
test(function() {
assert_equals(document.getElementById('seventh').offsetLeft, 150);
assert_equals(document.getElementById('seventh').offsetTop, 220);
}, "offsetLeft and offsetTop in vertical-lr at column boundaries, seventh element");
</script> </script>
<!DOCTYPE html> <!DOCTYPE html>
<script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/testharnessreport.js"></script>
<div style="position:relative; writing-mode:vertical-rl; columns:3; column-gap:10px; column-fill:auto; width:100px; height:320px;"> <div style="position:relative; writing-mode:vertical-rl; columns:3; column-gap:10px; height:320px;">
<div id="first" style="width:100px;"></div> <div id="first" style="width:100px;"></div>
<div id="second" style="width:100px;"></div> <div id="second" style="width:100px;"></div>
<div id="third" style="width:100px;"></div> <div id="third" style="width:100px;"></div>
<div id="spanner" style="column-span:all; width:50px;"></div>
<div id="fifth" style="width:100px;"></div>
<div id="sixth" style="width:100px;"></div>
<div id="seventh" style="width:100px;"></div>
</div> </div>
<script> <script>
test(function() { test(function() {
assert_equals(document.getElementById('first').offsetLeft, 0); assert_equals(document.getElementById('first').offsetLeft, 150);
assert_equals(document.getElementById('first').offsetTop, 0); assert_equals(document.getElementById('first').offsetTop, 0);
}, "offsetLeft and offsetTop in vertical-rl at column boundaries, first element"); }, "offsetLeft and offsetTop in vertical-rl at column boundaries, first element");
test(function() { test(function() {
assert_equals(document.getElementById('second').offsetLeft, 0); assert_equals(document.getElementById('second').offsetLeft, 150);
assert_equals(document.getElementById('second').offsetTop, 110); assert_equals(document.getElementById('second').offsetTop, 110);
}, "offsetLeft and offsetTop in vertical-rl at column boundaries, second element"); }, "offsetLeft and offsetTop in vertical-rl at column boundaries, second element");
test(function() { test(function() {
assert_equals(document.getElementById('third').offsetLeft, 0); assert_equals(document.getElementById('third').offsetLeft, 150);
assert_equals(document.getElementById('third').offsetTop, 220); assert_equals(document.getElementById('third').offsetTop, 220);
}, "offsetLeft and offsetTop in vertical-rl at column boundaries, third element"); }, "offsetLeft and offsetTop in vertical-rl at column boundaries, third element");
test(function() {
assert_equals(document.getElementById('spanner').offsetLeft, 100);
assert_equals(document.getElementById('spanner').offsetTop, 0);
}, "offsetLeft and offsetTop in vertical-rl, spanner");
test(function() {
assert_equals(document.getElementById('fifth').offsetLeft, 0);
assert_equals(document.getElementById('fifth').offsetTop, 0);
}, "offsetLeft and offsetTop in vertical-rl at column boundaries, fifth element");
test(function() {
assert_equals(document.getElementById('sixth').offsetLeft, 0);
assert_equals(document.getElementById('sixth').offsetTop, 110);
}, "offsetLeft and offsetTop in vertical-rl at column boundaries, sixth element");
test(function() {
assert_equals(document.getElementById('seventh').offsetLeft, 0);
assert_equals(document.getElementById('seventh').offsetTop, 220);
}, "offsetLeft and offsetTop in vertical-rl at column boundaries, seventh element");
</script> </script>
...@@ -28,7 +28,7 @@ FragmentainerIterator::FragmentainerIterator(const LayoutFlowThread& flowThread, ...@@ -28,7 +28,7 @@ FragmentainerIterator::FragmentainerIterator(const LayoutFlowThread& flowThread,
} }
// Jump to the first interesting column set. // Jump to the first interesting column set.
m_currentColumnSet = flowThread.columnSetAtBlockOffset(m_logicalTopInFlowThread); m_currentColumnSet = flowThread.columnSetAtBlockOffset(m_logicalTopInFlowThread, LayoutBox::AssociateWithLatterPage);
if (!m_currentColumnSet || m_currentColumnSet->logicalTopInFlowThread() >= m_logicalBottomInFlowThread) { if (!m_currentColumnSet || m_currentColumnSet->logicalTopInFlowThread() >= m_logicalBottomInFlowThread) {
setAtEnd(); setAtEnd();
return; return;
......
...@@ -130,7 +130,7 @@ bool LayoutFlowThread::nodeAtPoint(HitTestResult& result, const HitTestLocation& ...@@ -130,7 +130,7 @@ bool LayoutFlowThread::nodeAtPoint(HitTestResult& result, const HitTestLocation&
LayoutUnit LayoutFlowThread::pageLogicalHeightForOffset(LayoutUnit offset) LayoutUnit LayoutFlowThread::pageLogicalHeightForOffset(LayoutUnit offset)
{ {
LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(offset); LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(offset, AssociateWithLatterPage);
if (!columnSet) if (!columnSet)
return LayoutUnit(); return LayoutUnit();
...@@ -139,7 +139,7 @@ LayoutUnit LayoutFlowThread::pageLogicalHeightForOffset(LayoutUnit offset) ...@@ -139,7 +139,7 @@ LayoutUnit LayoutFlowThread::pageLogicalHeightForOffset(LayoutUnit offset)
LayoutUnit LayoutFlowThread::pageRemainingLogicalHeightForOffset(LayoutUnit offset, PageBoundaryRule pageBoundaryRule) LayoutUnit LayoutFlowThread::pageRemainingLogicalHeightForOffset(LayoutUnit offset, PageBoundaryRule pageBoundaryRule)
{ {
LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(offset); LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(offset, pageBoundaryRule);
if (!columnSet) if (!columnSet)
return LayoutUnit(); return LayoutUnit();
...@@ -157,7 +157,7 @@ void LayoutFlowThread::generateColumnSetIntervalTree() ...@@ -157,7 +157,7 @@ void LayoutFlowThread::generateColumnSetIntervalTree()
LayoutUnit LayoutFlowThread::nextLogicalTopForUnbreakableContent(LayoutUnit flowThreadOffset, LayoutUnit contentLogicalHeight) const LayoutUnit LayoutFlowThread::nextLogicalTopForUnbreakableContent(LayoutUnit flowThreadOffset, LayoutUnit contentLogicalHeight) const
{ {
LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(flowThreadOffset); LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(flowThreadOffset, AssociateWithLatterPage);
if (!columnSet) if (!columnSet)
return flowThreadOffset; return flowThreadOffset;
return columnSet->nextLogicalTopForUnbreakableContent(flowThreadOffset, contentLogicalHeight); return columnSet->nextLogicalTopForUnbreakableContent(flowThreadOffset, contentLogicalHeight);
......
...@@ -127,7 +127,7 @@ public: ...@@ -127,7 +127,7 @@ public:
virtual LayoutPoint flowThreadPointToVisualPoint(const LayoutPoint& flowThreadPoint) const = 0; virtual LayoutPoint flowThreadPointToVisualPoint(const LayoutPoint& flowThreadPoint) const = 0;
virtual LayoutPoint visualPointToFlowThreadPoint(const LayoutPoint& visualPoint) const = 0; virtual LayoutPoint visualPointToFlowThreadPoint(const LayoutPoint& visualPoint) const = 0;
virtual LayoutMultiColumnSet* columnSetAtBlockOffset(LayoutUnit) const = 0; virtual LayoutMultiColumnSet* columnSetAtBlockOffset(LayoutUnit, PageBoundaryRule) const = 0;
virtual const char* name() const = 0; virtual const char* name() const = 0;
......
...@@ -307,7 +307,7 @@ LayoutUnit LayoutMultiColumnFlowThread::maxColumnLogicalHeight() const ...@@ -307,7 +307,7 @@ LayoutUnit LayoutMultiColumnFlowThread::maxColumnLogicalHeight() const
LayoutUnit LayoutMultiColumnFlowThread::tallestUnbreakableLogicalHeight(LayoutUnit offsetInFlowThread) const LayoutUnit LayoutMultiColumnFlowThread::tallestUnbreakableLogicalHeight(LayoutUnit offsetInFlowThread) const
{ {
if (LayoutMultiColumnSet* multicolSet = columnSetAtBlockOffset(offsetInFlowThread)) if (LayoutMultiColumnSet* multicolSet = columnSetAtBlockOffset(offsetInFlowThread, AssociateWithLatterPage))
return multicolSet->tallestUnbreakableLogicalHeight(); return multicolSet->tallestUnbreakableLogicalHeight();
return LayoutUnit(); return LayoutUnit();
} }
...@@ -336,7 +336,7 @@ LayoutSize LayoutMultiColumnFlowThread::flowThreadTranslationAtOffset(LayoutUnit ...@@ -336,7 +336,7 @@ LayoutSize LayoutMultiColumnFlowThread::flowThreadTranslationAtOffset(LayoutUnit
{ {
if (!hasValidColumnSetInfo()) if (!hasValidColumnSetInfo())
return LayoutSize(0, 0); return LayoutSize(0, 0);
LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(offsetInFlowThread); LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(offsetInFlowThread, rule);
if (!columnSet) if (!columnSet)
return LayoutSize(0, 0); return LayoutSize(0, 0);
return columnSet->flowThreadTranslationAtOffset(offsetInFlowThread, rule, mode); return columnSet->flowThreadTranslationAtOffset(offsetInFlowThread, rule, mode);
...@@ -374,15 +374,16 @@ LayoutPoint LayoutMultiColumnFlowThread::visualPointToFlowThreadPoint(const Layo ...@@ -374,15 +374,16 @@ LayoutPoint LayoutMultiColumnFlowThread::visualPointToFlowThreadPoint(const Layo
int LayoutMultiColumnFlowThread::inlineBlockBaseline(LineDirectionMode lineDirection) const int LayoutMultiColumnFlowThread::inlineBlockBaseline(LineDirectionMode lineDirection) const
{ {
LayoutUnit baselineInFlowThread = LayoutUnit(LayoutFlowThread::inlineBlockBaseline(lineDirection)); LayoutUnit baselineInFlowThread = LayoutUnit(LayoutFlowThread::inlineBlockBaseline(lineDirection));
LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(baselineInFlowThread); LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(baselineInFlowThread, AssociateWithLatterPage);
if (!columnSet) if (!columnSet)
return baselineInFlowThread.toInt(); return baselineInFlowThread.toInt();
return (baselineInFlowThread - columnSet->pageLogicalTopForOffset(baselineInFlowThread)).ceil(); return (baselineInFlowThread - columnSet->pageLogicalTopForOffset(baselineInFlowThread)).ceil();
} }
LayoutMultiColumnSet* LayoutMultiColumnFlowThread::columnSetAtBlockOffset(LayoutUnit offset) const LayoutMultiColumnSet* LayoutMultiColumnFlowThread::columnSetAtBlockOffset(LayoutUnit offset, PageBoundaryRule pageBoundaryRule) const
{ {
if (LayoutMultiColumnSet* columnSet = m_lastSetWorkedOn) { LayoutMultiColumnSet* columnSet = m_lastSetWorkedOn;
if (columnSet) {
// Layout in progress. We are calculating the set heights as we speak, so the column set range // Layout in progress. We are calculating the set heights as we speak, so the column set range
// information is not up to date. // information is not up to date.
while (columnSet->logicalTopInFlowThread() > offset) { while (columnSet->logicalTopInFlowThread() > offset) {
...@@ -394,10 +395,8 @@ LayoutMultiColumnSet* LayoutMultiColumnFlowThread::columnSetAtBlockOffset(Layout ...@@ -394,10 +395,8 @@ LayoutMultiColumnSet* LayoutMultiColumnFlowThread::columnSetAtBlockOffset(Layout
break; break;
columnSet = previousSet; columnSet = previousSet;
} }
return columnSet; } else {
} DCHECK(!m_columnSetsInvalidated);
ASSERT(!m_columnSetsInvalidated);
if (m_multiColumnSetList.isEmpty()) if (m_multiColumnSetList.isEmpty())
return nullptr; return nullptr;
if (offset < LayoutUnit()) if (offset < LayoutUnit())
...@@ -409,7 +408,16 @@ LayoutMultiColumnSet* LayoutMultiColumnFlowThread::columnSetAtBlockOffset(Layout ...@@ -409,7 +408,16 @@ LayoutMultiColumnSet* LayoutMultiColumnFlowThread::columnSetAtBlockOffset(Layout
// If no set was found, the offset is in the flow thread overflow. // If no set was found, the offset is in the flow thread overflow.
if (!adapter.result() && !m_multiColumnSetList.isEmpty()) if (!adapter.result() && !m_multiColumnSetList.isEmpty())
return m_multiColumnSetList.last(); return m_multiColumnSetList.last();
return adapter.result(); columnSet = adapter.result();
}
if (pageBoundaryRule == AssociateWithFormerPage && columnSet && offset == columnSet->logicalTopInFlowThread()) {
// The column set that we found starts at the exact same flow thread offset as we specified.
// Since we are to associate offsets at boundaries with the former fragmentainer, the
// fragmentainer we're looking for is in the previous column set.
if (LayoutMultiColumnSet* previousSet = columnSet->previousSiblingMultiColumnSet())
return previousSet;
}
return columnSet;
} }
void LayoutMultiColumnFlowThread::layoutColumns(SubtreeLayoutScope& layoutScope) void LayoutMultiColumnFlowThread::layoutColumns(SubtreeLayoutScope& layoutScope)
...@@ -515,12 +523,7 @@ void LayoutMultiColumnFlowThread::appendNewFragmentainerGroupIfNeeded(LayoutUnit ...@@ -515,12 +523,7 @@ void LayoutMultiColumnFlowThread::appendNewFragmentainerGroupIfNeeded(LayoutUnit
// Its height is indefinite for now. // Its height is indefinite for now.
return; return;
} }
// TODO(mstensho): If pageBoundaryRule is AssociateWithFormerPage, offsetInFlowThread is an LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(offsetInFlowThread, pageBoundaryRule);
// endpoint-exclusive offset, i.e. the offset just after the bottom of some object. So, ideally,
// columnSetAtBlockOffset() should be informed about this (i.e. take a PageBoundaryRule
// argument). This is not the only place with this issue; see also
// pageRemainingLogicalHeightForOffset().
LayoutMultiColumnSet* columnSet = columnSetAtBlockOffset(offsetInFlowThread);
if (columnSet->isInitialHeightCalculated()) { if (columnSet->isInitialHeightCalculated()) {
// We only insert additional fragmentainer groups in the initial layout pass. We only want // We only insert additional fragmentainer groups in the initial layout pass. We only want
// to balance columns in the last fragmentainer group (if we need to balance at all), so we // to balance columns in the last fragmentainer group (if we need to balance at all), so we
......
...@@ -199,7 +199,7 @@ public: ...@@ -199,7 +199,7 @@ public:
int inlineBlockBaseline(LineDirectionMode) const override; int inlineBlockBaseline(LineDirectionMode) const override;
LayoutMultiColumnSet* columnSetAtBlockOffset(LayoutUnit) const final; LayoutMultiColumnSet* columnSetAtBlockOffset(LayoutUnit, PageBoundaryRule) const final;
void layoutColumns(SubtreeLayoutScope&); void layoutColumns(SubtreeLayoutScope&);
......
...@@ -281,16 +281,23 @@ TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffset) ...@@ -281,16 +281,23 @@ TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffset)
LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
EXPECT_EQ(columnSetSignature(flowThread), "cscsc"); EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet(); LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000), LayoutBox::AssociateWithFormerPage), firstRow); // negative overflow
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow); EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000), LayoutBox::AssociateWithLatterPage), firstRow); // negative overflow
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), firstRow); // bottom of last line in first row. EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(), LayoutBox::AssociateWithFormerPage), firstRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(), LayoutBox::AssociateWithLatterPage), firstRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499), LayoutBox::AssociateWithFormerPage), firstRow); // bottom of last line in first row.
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499), LayoutBox::AssociateWithLatterPage), firstRow); // bottom of last line in first row.
LayoutMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet(); LayoutMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet();
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500)), secondRow); EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500), LayoutBox::AssociateWithFormerPage), firstRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699)), secondRow); EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500), LayoutBox::AssociateWithLatterPage), secondRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699), LayoutBox::AssociateWithFormerPage), secondRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699), LayoutBox::AssociateWithLatterPage), secondRow);
LayoutMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet(); LayoutMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet();
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700)), thirdRow); EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700), LayoutBox::AssociateWithFormerPage), secondRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799)), thirdRow); // bottom of last row EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700), LayoutBox::AssociateWithLatterPage), thirdRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow); // overflow EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799), LayoutBox::AssociateWithLatterPage), thirdRow); // bottom of last row
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000), LayoutBox::AssociateWithFormerPage), thirdRow); // overflow
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000), LayoutBox::AssociateWithLatterPage), thirdRow); // overflow
} }
TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalRl) TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalRl)
...@@ -299,16 +306,23 @@ TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalRl) ...@@ -299,16 +306,23 @@ TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalRl)
LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
EXPECT_EQ(columnSetSignature(flowThread), "cscsc"); EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet(); LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000), LayoutBox::AssociateWithFormerPage), firstRow); // negative overflow
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow); EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000), LayoutBox::AssociateWithLatterPage), firstRow); // negative overflow
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), firstRow); // bottom of last line in first row. EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(), LayoutBox::AssociateWithFormerPage), firstRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(), LayoutBox::AssociateWithLatterPage), firstRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499), LayoutBox::AssociateWithFormerPage), firstRow); // bottom of last line in first row.
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499), LayoutBox::AssociateWithLatterPage), firstRow); // bottom of last line in first row.
LayoutMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet(); LayoutMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet();
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500)), secondRow); EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500), LayoutBox::AssociateWithFormerPage), firstRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699)), secondRow); EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500), LayoutBox::AssociateWithLatterPage), secondRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699), LayoutBox::AssociateWithFormerPage), secondRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699), LayoutBox::AssociateWithLatterPage), secondRow);
LayoutMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet(); LayoutMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet();
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700)), thirdRow); EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700), LayoutBox::AssociateWithFormerPage), secondRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799)), thirdRow); // bottom of last row EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700), LayoutBox::AssociateWithLatterPage), thirdRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow); // overflow EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799), LayoutBox::AssociateWithLatterPage), thirdRow); // bottom of last row
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000), LayoutBox::AssociateWithFormerPage), thirdRow); // overflow
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000), LayoutBox::AssociateWithLatterPage), thirdRow); // overflow
} }
TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalLr) TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalLr)
...@@ -317,16 +331,23 @@ TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalLr) ...@@ -317,16 +331,23 @@ TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalLr)
LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
EXPECT_EQ(columnSetSignature(flowThread), "cscsc"); EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet(); LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000), LayoutBox::AssociateWithFormerPage), firstRow); // negative overflow
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow); EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000), LayoutBox::AssociateWithLatterPage), firstRow); // negative overflow
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), firstRow); // bottom of last line in first row. EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(), LayoutBox::AssociateWithFormerPage), firstRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(), LayoutBox::AssociateWithLatterPage), firstRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499), LayoutBox::AssociateWithFormerPage), firstRow); // bottom of last line in first row.
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499), LayoutBox::AssociateWithLatterPage), firstRow); // bottom of last line in first row.
LayoutMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet(); LayoutMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet();
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500)), secondRow); EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500), LayoutBox::AssociateWithFormerPage), firstRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699)), secondRow); EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500), LayoutBox::AssociateWithLatterPage), secondRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699), LayoutBox::AssociateWithFormerPage), secondRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699), LayoutBox::AssociateWithLatterPage), secondRow);
LayoutMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet(); LayoutMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet();
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700)), thirdRow); EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700), LayoutBox::AssociateWithFormerPage), secondRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799)), thirdRow); // bottom of last row EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700), LayoutBox::AssociateWithLatterPage), thirdRow);
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow); // overflow EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799), LayoutBox::AssociateWithLatterPage), thirdRow); // bottom of last row
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000), LayoutBox::AssociateWithFormerPage), thirdRow); // overflow
EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000), LayoutBox::AssociateWithLatterPage), thirdRow); // overflow
} }
class MultiColumnTreeModifyingTest : public MultiColumnRenderingTest { class MultiColumnTreeModifyingTest : public MultiColumnRenderingTest {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment