| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutMultiColumnFlowThread.h" | 7 #include "core/layout/LayoutMultiColumnFlowThread.h" |
| 8 | 8 |
| 9 #include "core/layout/LayoutMultiColumnSet.h" | 9 #include "core/layout/LayoutMultiColumnSet.h" |
| 10 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" | 10 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 EXPECT_EQ(columnSetSignature("mc"), ""); | 103 EXPECT_EQ(columnSetSignature("mc"), ""); |
| 104 } | 104 } |
| 105 | 105 |
| 106 TEST_F(MultiColumnRenderingTest, OneBlock) | 106 TEST_F(MultiColumnRenderingTest, OneBlock) |
| 107 { | 107 { |
| 108 // There is some content, so we should create a column set. | 108 // There is some content, so we should create a column set. |
| 109 setMulticolHTML("<div id='mc'><div id='block'></div></div>"); | 109 setMulticolHTML("<div id='mc'><div id='block'></div></div>"); |
| 110 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); | 110 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); |
| 111 ASSERT_EQ(columnSetSignature(flowThread), "c"); | 111 ASSERT_EQ(columnSetSignature(flowThread), "c"); |
| 112 LayoutMultiColumnSet* columnSet = flowThread->firstMultiColumnSet(); | 112 LayoutMultiColumnSet* columnSet = flowThread->firstMultiColumnSet(); |
| 113 EXPECT_EQ(flowThread->findSetLayoutObjects(document().getElementById("block"
)->layoutObject()), columnSet); | 113 EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("bl
ock")->layoutObject()), columnSet); |
| 114 } | 114 } |
| 115 | 115 |
| 116 TEST_F(MultiColumnRenderingTest, TwoBlocks) | 116 TEST_F(MultiColumnRenderingTest, TwoBlocks) |
| 117 { | 117 { |
| 118 // No matter how much content, we should only create one column set (unless
there are spanners). | 118 // No matter how much content, we should only create one column set (unless
there are spanners). |
| 119 setMulticolHTML("<div id='mc'><div id='block1'></div><div id='block2'></div>
</div>"); | 119 setMulticolHTML("<div id='mc'><div id='block1'></div><div id='block2'></div>
</div>"); |
| 120 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); | 120 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); |
| 121 ASSERT_EQ(columnSetSignature(flowThread), "c"); | 121 ASSERT_EQ(columnSetSignature(flowThread), "c"); |
| 122 LayoutMultiColumnSet* columnSet = flowThread->firstMultiColumnSet(); | 122 LayoutMultiColumnSet* columnSet = flowThread->firstMultiColumnSet(); |
| 123 EXPECT_EQ(flowThread->findSetLayoutObjects(document().getElementById("block1
")->layoutObject()), columnSet); | 123 EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("bl
ock1")->layoutObject()), columnSet); |
| 124 EXPECT_EQ(flowThread->findSetLayoutObjects(document().getElementById("block2
")->layoutObject()), columnSet); | 124 EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("bl
ock2")->layoutObject()), columnSet); |
| 125 } | 125 } |
| 126 | 126 |
| 127 TEST_F(MultiColumnRenderingTest, Spanner) | 127 TEST_F(MultiColumnRenderingTest, Spanner) |
| 128 { | 128 { |
| 129 // With one spanner and no column content, we should create a spanner set. | 129 // With one spanner and no column content, we should create a spanner set. |
| 130 setMulticolHTML("<div id='mc'><div id='spanner'></div></div>"); | 130 setMulticolHTML("<div id='mc'><div id='spanner'></div></div>"); |
| 131 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); | 131 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); |
| 132 ASSERT_EQ(columnSetSignature(flowThread), "s"); | 132 ASSERT_EQ(columnSetSignature(flowThread), "s"); |
| 133 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); | 133 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); |
| 134 EXPECT_EQ(flowThread->firstMultiColumnSet(), nullptr); | 134 EXPECT_EQ(flowThread->firstMultiColumnSet(), nullptr); |
| 135 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner")->layoutObject()), columnBox); | 135 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner")->layoutObject()), columnBox); |
| 136 EXPECT_EQ(document().getElementById("spanner")->layoutObject()->spannerPlace
holder(), columnBox); | 136 EXPECT_EQ(document().getElementById("spanner")->layoutObject()->spannerPlace
holder(), columnBox); |
| 137 } | 137 } |
| 138 | 138 |
| 139 TEST_F(MultiColumnRenderingTest, ContentThenSpanner) | 139 TEST_F(MultiColumnRenderingTest, ContentThenSpanner) |
| 140 { | 140 { |
| 141 // With some column content followed by a spanner, we need a column set foll
owed by a spanner set. | 141 // With some column content followed by a spanner, we need a column set foll
owed by a spanner set. |
| 142 setMulticolHTML("<div id='mc'><div id='columnContent'></div><div id='spanner
'></div></div>"); | 142 setMulticolHTML("<div id='mc'><div id='columnContent'></div><div id='spanner
'></div></div>"); |
| 143 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); | 143 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); |
| 144 ASSERT_EQ(columnSetSignature(flowThread), "cs"); | 144 ASSERT_EQ(columnSetSignature(flowThread), "cs"); |
| 145 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); | 145 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); |
| 146 EXPECT_EQ(flowThread->findSetLayoutObjects(document().getElementById("column
Content")->layoutObject()), columnBox); | 146 EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("co
lumnContent")->layoutObject()), columnBox); |
| 147 columnBox = columnBox->nextSiblingMultiColumnBox(); | 147 columnBox = columnBox->nextSiblingMultiColumnBox(); |
| 148 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner")->layoutObject()), columnBox); | 148 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner")->layoutObject()), columnBox); |
| 149 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("columnContent")->layoutObject()), nullptr); | 149 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("columnContent")->layoutObject()), nullptr); |
| 150 } | 150 } |
| 151 | 151 |
| 152 TEST_F(MultiColumnRenderingTest, SpannerThenContent) | 152 TEST_F(MultiColumnRenderingTest, SpannerThenContent) |
| 153 { | 153 { |
| 154 // With a spanner followed by some column content, we need a spanner set fol
lowed by a column set. | 154 // With a spanner followed by some column content, we need a spanner set fol
lowed by a column set. |
| 155 setMulticolHTML("<div id='mc'><div id='spanner'></div><div id='columnContent
'></div></div>"); | 155 setMulticolHTML("<div id='mc'><div id='spanner'></div><div id='columnContent
'></div></div>"); |
| 156 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); | 156 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); |
| 157 ASSERT_EQ(columnSetSignature(flowThread), "sc"); | 157 ASSERT_EQ(columnSetSignature(flowThread), "sc"); |
| 158 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); | 158 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); |
| 159 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner")->layoutObject()), columnBox); | 159 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner")->layoutObject()), columnBox); |
| 160 columnBox = columnBox->nextSiblingMultiColumnBox(); | 160 columnBox = columnBox->nextSiblingMultiColumnBox(); |
| 161 EXPECT_EQ(flowThread->findSetLayoutObjects(document().getElementById("column
Content")->layoutObject()), columnBox); | 161 EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("co
lumnContent")->layoutObject()), columnBox); |
| 162 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("columnContent")->layoutObject()), nullptr); | 162 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("columnContent")->layoutObject()), nullptr); |
| 163 } | 163 } |
| 164 | 164 |
| 165 TEST_F(MultiColumnRenderingTest, ContentThenSpannerThenContent) | 165 TEST_F(MultiColumnRenderingTest, ContentThenSpannerThenContent) |
| 166 { | 166 { |
| 167 // With column content followed by a spanner followed by some column content
, we need a column | 167 // With column content followed by a spanner followed by some column content
, we need a column |
| 168 // set followed by a spanner set followed by a column set. | 168 // set followed by a spanner set followed by a column set. |
| 169 setMulticolHTML("<div id='mc'><div id='columnContentBefore'></div><div id='s
panner'></div><div id='columnContentAfter'></div></div>"); | 169 setMulticolHTML("<div id='mc'><div id='columnContentBefore'></div><div id='s
panner'></div><div id='columnContentAfter'></div></div>"); |
| 170 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); | 170 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); |
| 171 ASSERT_EQ(columnSetSignature(flowThread), "csc"); | 171 ASSERT_EQ(columnSetSignature(flowThread), "csc"); |
| 172 LayoutBox* columnBox = flowThread->firstMultiColumnSet(); | 172 LayoutBox* columnBox = flowThread->firstMultiColumnSet(); |
| 173 EXPECT_EQ(flowThread->findSetLayoutObjects(document().getElementById("column
ContentBefore")->layoutObject()), columnBox); | 173 EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("co
lumnContentBefore")->layoutObject()), columnBox); |
| 174 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("columnContentBefore")->layoutObject()), nullptr); | 174 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("columnContentBefore")->layoutObject()), nullptr); |
| 175 columnBox = columnBox->nextSiblingMultiColumnBox(); | 175 columnBox = columnBox->nextSiblingMultiColumnBox(); |
| 176 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner")->layoutObject()), columnBox); | 176 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner")->layoutObject()), columnBox); |
| 177 columnBox = columnBox->nextSiblingMultiColumnBox(); | 177 columnBox = columnBox->nextSiblingMultiColumnBox(); |
| 178 EXPECT_EQ(flowThread->findSetLayoutObjects(document().getElementById("column
ContentAfter")->layoutObject()), columnBox); | 178 EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("co
lumnContentAfter")->layoutObject()), columnBox); |
| 179 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("columnContentAfter")->layoutObject()), nullptr); | 179 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("columnContentAfter")->layoutObject()), nullptr); |
| 180 } | 180 } |
| 181 | 181 |
| 182 TEST_F(MultiColumnRenderingTest, TwoSpanners) | 182 TEST_F(MultiColumnRenderingTest, TwoSpanners) |
| 183 { | 183 { |
| 184 // With two spanners and no column content, we need two spanner sets. | 184 // With two spanners and no column content, we need two spanner sets. |
| 185 setMulticolHTML("<div id='mc'><div id='spanner1'></div><div id='spanner2'></
div></div>"); | 185 setMulticolHTML("<div id='mc'><div id='spanner1'></div><div id='spanner2'></
div></div>"); |
| 186 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); | 186 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); |
| 187 ASSERT_EQ(columnSetSignature(flowThread), "ss"); | 187 ASSERT_EQ(columnSetSignature(flowThread), "ss"); |
| 188 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); | 188 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 199 // With two spanners and some column content in-between, we need a spanner s
et, a column set and another spanner set. | 199 // With two spanners and some column content in-between, we need a spanner s
et, a column set and another spanner set. |
| 200 setMulticolHTML("<div id='mc'><div id='spanner1'></div><div id='columnConten
t'></div><div id='spanner2'></div></div>"); | 200 setMulticolHTML("<div id='mc'><div id='spanner1'></div><div id='columnConten
t'></div><div id='spanner2'></div></div>"); |
| 201 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); | 201 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); |
| 202 ASSERT_EQ(columnSetSignature(flowThread), "scs"); | 202 ASSERT_EQ(columnSetSignature(flowThread), "scs"); |
| 203 LayoutMultiColumnSet* columnSet = flowThread->firstMultiColumnSet(); | 203 LayoutMultiColumnSet* columnSet = flowThread->firstMultiColumnSet(); |
| 204 EXPECT_EQ(columnSet->nextSiblingMultiColumnSet(), nullptr); | 204 EXPECT_EQ(columnSet->nextSiblingMultiColumnSet(), nullptr); |
| 205 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); | 205 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); |
| 206 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner1")->layoutObject()), columnBox); | 206 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner1")->layoutObject()), columnBox); |
| 207 columnBox = columnBox->nextSiblingMultiColumnBox(); | 207 columnBox = columnBox->nextSiblingMultiColumnBox(); |
| 208 EXPECT_EQ(columnBox, columnSet); | 208 EXPECT_EQ(columnBox, columnSet); |
| 209 EXPECT_EQ(flowThread->findSetLayoutObjects(document().getElementById("column
Content")->layoutObject()), columnSet); | 209 EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("co
lumnContent")->layoutObject()), columnSet); |
| 210 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("columnContent")->layoutObject()), nullptr); | 210 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("columnContent")->layoutObject()), nullptr); |
| 211 columnBox = columnBox->nextSiblingMultiColumnBox(); | 211 columnBox = columnBox->nextSiblingMultiColumnBox(); |
| 212 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner2")->layoutObject()), columnBox); | 212 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner2")->layoutObject()), columnBox); |
| 213 } | 213 } |
| 214 | 214 |
| 215 TEST_F(MultiColumnRenderingTest, SpannerWithSpanner) | 215 TEST_F(MultiColumnRenderingTest, SpannerWithSpanner) |
| 216 { | 216 { |
| 217 // column-span:all on something inside column-span:all has no effect. | 217 // column-span:all on something inside column-span:all has no effect. |
| 218 setMulticolHTML("<div id='mc'><div id='spanner'><div id='invalidSpanner' cla
ss='s'></div></div></div>"); | 218 setMulticolHTML("<div id='mc'><div id='spanner'><div id='invalidSpanner' cla
ss='s'></div></div></div>"); |
| 219 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); | 219 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); |
| 220 ASSERT_EQ(columnSetSignature(flowThread), "s"); | 220 ASSERT_EQ(columnSetSignature(flowThread), "s"); |
| 221 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); | 221 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); |
| 222 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner")->layoutObject()), columnBox); | 222 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner")->layoutObject()), columnBox); |
| 223 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("invalidSpanner")->layoutObject()), columnBox); | 223 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("invalidSpanner")->layoutObject()), columnBox); |
| 224 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFl
owThread(), document().getElementById("spanner")->layoutObject()); | 224 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFl
owThread(), document().getElementById("spanner")->layoutObject()); |
| 225 EXPECT_EQ(document().getElementById("spanner")->layoutObject()->spannerPlace
holder(), columnBox); | 225 EXPECT_EQ(document().getElementById("spanner")->layoutObject()->spannerPlace
holder(), columnBox); |
| 226 EXPECT_EQ(document().getElementById("invalidSpanner")->layoutObject()->spann
erPlaceholder(), nullptr); | 226 EXPECT_EQ(document().getElementById("invalidSpanner")->layoutObject()->spann
erPlaceholder(), nullptr); |
| 227 } | 227 } |
| 228 | 228 |
| 229 TEST_F(MultiColumnRenderingTest, SubtreeWithSpanner) | 229 TEST_F(MultiColumnRenderingTest, SubtreeWithSpanner) |
| 230 { | 230 { |
| 231 setMulticolHTML("<div id='mc'><div id='outer'><div id='block1'></div><div id
='spanner'></div><div id='block2'></div></div></div>"); | 231 setMulticolHTML("<div id='mc'><div id='outer'><div id='block1'></div><div id
='spanner'></div><div id='block2'></div></div></div>"); |
| 232 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); | 232 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); |
| 233 EXPECT_EQ(columnSetSignature(flowThread), "csc"); | 233 EXPECT_EQ(columnSetSignature(flowThread), "csc"); |
| 234 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); | 234 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); |
| 235 EXPECT_EQ(flowThread->findSetLayoutObjects(document().getElementById("outer"
)->layoutObject()), columnBox); | 235 EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("ou
ter")->layoutObject()), columnBox); |
| 236 EXPECT_EQ(flowThread->findSetLayoutObjects(document().getElementById("block1
")->layoutObject()), columnBox); | 236 EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("bl
ock1")->layoutObject()), columnBox); |
| 237 columnBox = columnBox->nextSiblingMultiColumnBox(); | 237 columnBox = columnBox->nextSiblingMultiColumnBox(); |
| 238 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner")->layoutObject()), columnBox); | 238 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner")->layoutObject()), columnBox); |
| 239 EXPECT_EQ(document().getElementById("spanner")->layoutObject()->spannerPlace
holder(), columnBox); | 239 EXPECT_EQ(document().getElementById("spanner")->layoutObject()->spannerPlace
holder(), columnBox); |
| 240 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFl
owThread(), document().getElementById("spanner")->layoutObject()); | 240 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFl
owThread(), document().getElementById("spanner")->layoutObject()); |
| 241 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("outer")->layoutObject()), nullptr); | 241 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("outer")->layoutObject()), nullptr); |
| 242 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("block1")->layoutObject()), nullptr); | 242 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("block1")->layoutObject()), nullptr); |
| 243 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("block2")->layoutObject()), nullptr); | 243 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("block2")->layoutObject()), nullptr); |
| 244 columnBox = columnBox->nextSiblingMultiColumnBox(); | 244 columnBox = columnBox->nextSiblingMultiColumnBox(); |
| 245 EXPECT_EQ(flowThread->findSetLayoutObjects(document().getElementById("block2
")->layoutObject()), columnBox); | 245 EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("bl
ock2")->layoutObject()), columnBox); |
| 246 } | 246 } |
| 247 | 247 |
| 248 TEST_F(MultiColumnRenderingTest, SubtreeWithSpannerAfterSpanner) | 248 TEST_F(MultiColumnRenderingTest, SubtreeWithSpannerAfterSpanner) |
| 249 { | 249 { |
| 250 setMulticolHTML("<div id='mc'><div id='spanner1'></div><div id='outer'>text<
div id='spanner2'></div><div id='after'></div></div></div>"); | 250 setMulticolHTML("<div id='mc'><div id='spanner1'></div><div id='outer'>text<
div id='spanner2'></div><div id='after'></div></div></div>"); |
| 251 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); | 251 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); |
| 252 EXPECT_EQ(columnSetSignature(flowThread), "scsc"); | 252 EXPECT_EQ(columnSetSignature(flowThread), "scsc"); |
| 253 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); | 253 LayoutBox* columnBox = flowThread->firstMultiColumnBox(); |
| 254 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner1")->layoutObject()), columnBox); | 254 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner1")->layoutObject()), columnBox); |
| 255 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFl
owThread(), document().getElementById("spanner1")->layoutObject()); | 255 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFl
owThread(), document().getElementById("spanner1")->layoutObject()); |
| 256 EXPECT_EQ(document().getElementById("spanner1")->layoutObject()->spannerPlac
eholder(), columnBox); | 256 EXPECT_EQ(document().getElementById("spanner1")->layoutObject()->spannerPlac
eholder(), columnBox); |
| 257 columnBox = columnBox->nextSiblingMultiColumnBox(); | 257 columnBox = columnBox->nextSiblingMultiColumnBox(); |
| 258 EXPECT_EQ(flowThread->findSetLayoutObjects(document().getElementById("outer"
)->layoutObject()), columnBox); | 258 EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("ou
ter")->layoutObject()), columnBox); |
| 259 columnBox = columnBox->nextSiblingMultiColumnBox(); | 259 columnBox = columnBox->nextSiblingMultiColumnBox(); |
| 260 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner2")->layoutObject()), columnBox); | 260 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner2")->layoutObject()), columnBox); |
| 261 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFl
owThread(), document().getElementById("spanner2")->layoutObject()); | 261 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFl
owThread(), document().getElementById("spanner2")->layoutObject()); |
| 262 EXPECT_EQ(document().getElementById("spanner2")->layoutObject()->spannerPlac
eholder(), columnBox); | 262 EXPECT_EQ(document().getElementById("spanner2")->layoutObject()->spannerPlac
eholder(), columnBox); |
| 263 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("outer")->layoutObject()), nullptr); | 263 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("outer")->layoutObject()), nullptr); |
| 264 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("after")->layoutObject()), nullptr); | 264 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("after")->layoutObject()), nullptr); |
| 265 columnBox = columnBox->nextSiblingMultiColumnBox(); | 265 columnBox = columnBox->nextSiblingMultiColumnBox(); |
| 266 EXPECT_EQ(flowThread->findSetLayoutObjects(document().getElementById("after"
)->layoutObject()), columnBox); | 266 EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("af
ter")->layoutObject()), columnBox); |
| 267 } | 267 } |
| 268 | 268 |
| 269 TEST_F(MultiColumnRenderingTest, SubtreeWithSpannerBeforeSpanner) | 269 TEST_F(MultiColumnRenderingTest, SubtreeWithSpannerBeforeSpanner) |
| 270 { | 270 { |
| 271 setMulticolHTML("<div id='mc'><div id='outer'>text<div id='spanner1'></div>t
ext</div><div id='spanner2'></div></div>"); | 271 setMulticolHTML("<div id='mc'><div id='outer'>text<div id='spanner1'></div>t
ext</div><div id='spanner2'></div></div>"); |
| 272 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); | 272 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); |
| 273 EXPECT_EQ(columnSetSignature(flowThread), "cscs"); | 273 EXPECT_EQ(columnSetSignature(flowThread), "cscs"); |
| 274 LayoutBox* columnBox = flowThread->firstMultiColumnSet(); | 274 LayoutBox* columnBox = flowThread->firstMultiColumnSet(); |
| 275 EXPECT_EQ(flowThread->findSetLayoutObjects(document().getElementById("outer"
)->layoutObject()), columnBox); | 275 EXPECT_EQ(flowThread->mapDescendantToColumnSet(document().getElementById("ou
ter")->layoutObject()), columnBox); |
| 276 columnBox = columnBox->nextSiblingMultiColumnBox(); | 276 columnBox = columnBox->nextSiblingMultiColumnBox(); |
| 277 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner1")->layoutObject()), columnBox); | 277 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner1")->layoutObject()), columnBox); |
| 278 EXPECT_EQ(document().getElementById("spanner1")->layoutObject()->spannerPlac
eholder(), columnBox); | 278 EXPECT_EQ(document().getElementById("spanner1")->layoutObject()->spannerPlac
eholder(), columnBox); |
| 279 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFl
owThread(), document().getElementById("spanner1")->layoutObject()); | 279 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFl
owThread(), document().getElementById("spanner1")->layoutObject()); |
| 280 columnBox = columnBox->nextSiblingMultiColumnBox()->nextSiblingMultiColumnBo
x(); | 280 columnBox = columnBox->nextSiblingMultiColumnBox()->nextSiblingMultiColumnBo
x(); |
| 281 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner2")->layoutObject()), columnBox); | 281 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("spanner2")->layoutObject()), columnBox); |
| 282 EXPECT_EQ(document().getElementById("spanner2")->layoutObject()->spannerPlac
eholder(), columnBox); | 282 EXPECT_EQ(document().getElementById("spanner2")->layoutObject()->spannerPlac
eholder(), columnBox); |
| 283 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFl
owThread(), document().getElementById("spanner2")->layoutObject()); | 283 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFl
owThread(), document().getElementById("spanner2")->layoutObject()); |
| 284 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("outer")->layoutObject()), nullptr); | 284 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme
ntById("outer")->layoutObject()), nullptr); |
| 285 } | 285 } |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 { | 797 { |
| 798 setMulticolHTML("<div id='mc'>text<div id='spanner'><div class='s'></div></d
iv>text</div>"); | 798 setMulticolHTML("<div id='mc'>text<div id='spanner'><div class='s'></div></d
iv>text</div>"); |
| 799 EXPECT_EQ(columnSetSignature("mc"), "csc"); | 799 EXPECT_EQ(columnSetSignature("mc"), "csc"); |
| 800 destroyLayoutObject("spanner"); | 800 destroyLayoutObject("spanner"); |
| 801 EXPECT_EQ(columnSetSignature("mc"), "c"); | 801 EXPECT_EQ(columnSetSignature("mc"), "c"); |
| 802 } | 802 } |
| 803 | 803 |
| 804 } // anonymous namespace | 804 } // anonymous namespace |
| 805 | 805 |
| 806 } // namespace blink | 806 } // namespace blink |
| OLD | NEW |