Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: Source/core/layout/LayoutMultiColumnFlowThreadTest.cpp

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutListItem.cpp ('k') | Source/core/layout/LayoutObject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16 matching lines...) Expand all
27 String columnSetSignature(const char* multicolId); 27 String columnSetSignature(const char* multicolId);
28 28
29 void setMulticolHTML(const String&); 29 void setMulticolHTML(const String&);
30 }; 30 };
31 31
32 LayoutMultiColumnFlowThread* MultiColumnRenderingTest::findFlowThread(const char * id) const 32 LayoutMultiColumnFlowThread* MultiColumnRenderingTest::findFlowThread(const char * id) const
33 { 33 {
34 Node* multicol = document().getElementById(id); 34 Node* multicol = document().getElementById(id);
35 if (!multicol) 35 if (!multicol)
36 return 0; 36 return 0;
37 LayoutBlockFlow* multicolContainer = toLayoutBlockFlow(multicol->renderer()) ; 37 LayoutBlockFlow* multicolContainer = toLayoutBlockFlow(multicol->layoutObjec t());
38 if (!multicolContainer) 38 if (!multicolContainer)
39 return 0; 39 return 0;
40 return multicolContainer->multiColumnFlowThread(); 40 return multicolContainer->multiColumnFlowThread();
41 } 41 }
42 42
43 String MultiColumnRenderingTest::columnSetSignature(LayoutMultiColumnFlowThread* flowThread) 43 String MultiColumnRenderingTest::columnSetSignature(LayoutMultiColumnFlowThread* flowThread)
44 { 44 {
45 String signature = ""; 45 String signature = "";
46 for (LayoutBox* columnBox = flowThread->firstMultiColumnBox(); 46 for (LayoutBox* columnBox = flowThread->firstMultiColumnBox();
47 columnBox; 47 columnBox;
(...skipping 22 matching lines...) Expand all
70 "</style>"; 70 "</style>";
71 setBodyInnerHTML(style + html); 71 setBodyInnerHTML(style + html);
72 } 72 }
73 73
74 TEST_F(MultiColumnRenderingTest, OneBlockWithInDepthTreeStructureCheck) 74 TEST_F(MultiColumnRenderingTest, OneBlockWithInDepthTreeStructureCheck)
75 { 75 {
76 // Examine the render tree established by a simple multicol container with a block with some text inside. 76 // Examine the render tree established by a simple multicol container with a block with some text inside.
77 setMulticolHTML("<div id='mc'><div>xxx</div></div>"); 77 setMulticolHTML("<div id='mc'><div>xxx</div></div>");
78 Node* multicol = document().getElementById("mc"); 78 Node* multicol = document().getElementById("mc");
79 ASSERT_TRUE(multicol); 79 ASSERT_TRUE(multicol);
80 LayoutBlockFlow* multicolContainer = toLayoutBlockFlow(multicol->renderer()) ; 80 LayoutBlockFlow* multicolContainer = toLayoutBlockFlow(multicol->layoutObjec t());
81 ASSERT_TRUE(multicolContainer); 81 ASSERT_TRUE(multicolContainer);
82 LayoutMultiColumnFlowThread* flowThread = multicolContainer->multiColumnFlow Thread(); 82 LayoutMultiColumnFlowThread* flowThread = multicolContainer->multiColumnFlow Thread();
83 ASSERT_TRUE(flowThread); 83 ASSERT_TRUE(flowThread);
84 EXPECT_EQ(columnSetSignature(flowThread), "c"); 84 EXPECT_EQ(columnSetSignature(flowThread), "c");
85 EXPECT_EQ(flowThread->parent(), multicolContainer); 85 EXPECT_EQ(flowThread->parent(), multicolContainer);
86 EXPECT_FALSE(flowThread->previousSibling()); 86 EXPECT_FALSE(flowThread->previousSibling());
87 LayoutMultiColumnSet* columnSet = flowThread->firstMultiColumnSet(); 87 LayoutMultiColumnSet* columnSet = flowThread->firstMultiColumnSet();
88 ASSERT_TRUE(columnSet); 88 ASSERT_TRUE(columnSet);
89 EXPECT_EQ(columnSet->previousSibling(), flowThread); 89 EXPECT_EQ(columnSet->previousSibling(), flowThread);
90 EXPECT_FALSE(columnSet->nextSibling()); 90 EXPECT_FALSE(columnSet->nextSibling());
(...skipping 12 matching lines...) Expand all
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->findSetRendering(document().getElementById("block")->r enderer()), columnSet); 113 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("block")->l ayoutObject()), 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->findSetRendering(document().getElementById("block1")-> renderer()), columnSet); 123 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("block1")-> layoutObject()), columnSet);
124 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("block2")-> renderer()), columnSet); 124 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("block2")-> 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")->renderer()), columnBox); 135 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner")->layoutObject()), columnBox);
136 EXPECT_EQ(document().getElementById("spanner")->renderer()->spannerPlacehold er(), 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->findSetRendering(document().getElementById("columnCont ent")->renderer()), columnBox); 146 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("columnCont ent")->layoutObject()), columnBox);
147 columnBox = columnBox->nextSiblingMultiColumnBox(); 147 columnBox = columnBox->nextSiblingMultiColumnBox();
148 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner")->renderer()), columnBox); 148 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner")->layoutObject()), columnBox);
149 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("columnContent")->renderer()), 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")->renderer()), columnBox); 159 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner")->layoutObject()), columnBox);
160 columnBox = columnBox->nextSiblingMultiColumnBox(); 160 columnBox = columnBox->nextSiblingMultiColumnBox();
161 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("columnCont ent")->renderer()), columnBox); 161 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("columnCont ent")->layoutObject()), columnBox);
162 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("columnContent")->renderer()), 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->findSetRendering(document().getElementById("columnCont entBefore")->renderer()), columnBox); 173 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("columnCont entBefore")->layoutObject()), columnBox);
174 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("columnContentBefore")->renderer()), 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")->renderer()), columnBox); 176 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner")->layoutObject()), columnBox);
177 columnBox = columnBox->nextSiblingMultiColumnBox(); 177 columnBox = columnBox->nextSiblingMultiColumnBox();
178 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("columnCont entAfter")->renderer()), columnBox); 178 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("columnCont entAfter")->layoutObject()), columnBox);
179 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("columnContentAfter")->renderer()), 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();
189 EXPECT_EQ(flowThread->firstMultiColumnSet(), nullptr); 189 EXPECT_EQ(flowThread->firstMultiColumnSet(), nullptr);
190 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner1")->renderer()), columnBox); 190 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner1")->layoutObject()), columnBox);
191 EXPECT_EQ(document().getElementById("spanner1")->renderer()->spannerPlacehol der(), columnBox); 191 EXPECT_EQ(document().getElementById("spanner1")->layoutObject()->spannerPlac eholder(), columnBox);
192 columnBox = columnBox->nextSiblingMultiColumnBox(); 192 columnBox = columnBox->nextSiblingMultiColumnBox();
193 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner2")->renderer()), columnBox); 193 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner2")->layoutObject()), columnBox);
194 EXPECT_EQ(document().getElementById("spanner2")->renderer()->spannerPlacehol der(), columnBox); 194 EXPECT_EQ(document().getElementById("spanner2")->layoutObject()->spannerPlac eholder(), columnBox);
195 } 195 }
196 196
197 TEST_F(MultiColumnRenderingTest, SpannerThenContentThenSpanner) 197 TEST_F(MultiColumnRenderingTest, SpannerThenContentThenSpanner)
198 { 198 {
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")->renderer()), 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->findSetRendering(document().getElementById("columnCont ent")->renderer()), columnSet); 209 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("columnCont ent")->layoutObject()), columnSet);
210 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("columnContent")->renderer()), 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")->renderer()), 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")->renderer()), columnBox); 222 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner")->layoutObject()), columnBox);
223 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("invalidSpanner")->renderer()), columnBox); 223 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("invalidSpanner")->layoutObject()), columnBox);
224 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), document().getElementById("spanner")->renderer()); 224 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), document().getElementById("spanner")->layoutObject());
225 EXPECT_EQ(document().getElementById("spanner")->renderer()->spannerPlacehold er(), columnBox); 225 EXPECT_EQ(document().getElementById("spanner")->layoutObject()->spannerPlace holder(), columnBox);
226 EXPECT_EQ(document().getElementById("invalidSpanner")->renderer()->spannerPl aceholder(), 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->findSetRendering(document().getElementById("outer")->r enderer()), columnBox); 235 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("outer")->l ayoutObject()), columnBox);
236 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("block1")-> renderer()), columnBox); 236 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("block1")-> layoutObject()), columnBox);
237 columnBox = columnBox->nextSiblingMultiColumnBox(); 237 columnBox = columnBox->nextSiblingMultiColumnBox();
238 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner")->renderer()), columnBox); 238 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner")->layoutObject()), columnBox);
239 EXPECT_EQ(document().getElementById("spanner")->renderer()->spannerPlacehold er(), columnBox); 239 EXPECT_EQ(document().getElementById("spanner")->layoutObject()->spannerPlace holder(), columnBox);
240 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), document().getElementById("spanner")->renderer()); 240 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), document().getElementById("spanner")->layoutObject());
241 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("outer")->renderer()), nullptr); 241 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("outer")->layoutObject()), nullptr);
242 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("block1")->renderer()), nullptr); 242 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("block1")->layoutObject()), nullptr);
243 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("block2")->renderer()), nullptr); 243 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("block2")->layoutObject()), nullptr);
244 columnBox = columnBox->nextSiblingMultiColumnBox(); 244 columnBox = columnBox->nextSiblingMultiColumnBox();
245 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("block2")-> renderer()), columnBox); 245 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("block2")-> 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")->renderer()), columnBox); 254 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner1")->layoutObject()), columnBox);
255 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), document().getElementById("spanner1")->renderer()); 255 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), document().getElementById("spanner1")->layoutObject());
256 EXPECT_EQ(document().getElementById("spanner1")->renderer()->spannerPlacehol der(), columnBox); 256 EXPECT_EQ(document().getElementById("spanner1")->layoutObject()->spannerPlac eholder(), columnBox);
257 columnBox = columnBox->nextSiblingMultiColumnBox(); 257 columnBox = columnBox->nextSiblingMultiColumnBox();
258 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("outer")->r enderer()), columnBox); 258 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("outer")->l ayoutObject()), columnBox);
259 columnBox = columnBox->nextSiblingMultiColumnBox(); 259 columnBox = columnBox->nextSiblingMultiColumnBox();
260 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner2")->renderer()), columnBox); 260 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner2")->layoutObject()), columnBox);
261 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), document().getElementById("spanner2")->renderer()); 261 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), document().getElementById("spanner2")->layoutObject());
262 EXPECT_EQ(document().getElementById("spanner2")->renderer()->spannerPlacehol der(), columnBox); 262 EXPECT_EQ(document().getElementById("spanner2")->layoutObject()->spannerPlac eholder(), columnBox);
263 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("outer")->renderer()), nullptr); 263 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("outer")->layoutObject()), nullptr);
264 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("after")->renderer()), nullptr); 264 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("after")->layoutObject()), nullptr);
265 columnBox = columnBox->nextSiblingMultiColumnBox(); 265 columnBox = columnBox->nextSiblingMultiColumnBox();
266 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("after")->r enderer()), columnBox); 266 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("after")->l ayoutObject()), 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->findSetRendering(document().getElementById("outer")->r enderer()), columnBox); 275 EXPECT_EQ(flowThread->findSetRendering(document().getElementById("outer")->l ayoutObject()), columnBox);
276 columnBox = columnBox->nextSiblingMultiColumnBox(); 276 columnBox = columnBox->nextSiblingMultiColumnBox();
277 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner1")->renderer()), columnBox); 277 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner1")->layoutObject()), columnBox);
278 EXPECT_EQ(document().getElementById("spanner1")->renderer()->spannerPlacehol der(), columnBox); 278 EXPECT_EQ(document().getElementById("spanner1")->layoutObject()->spannerPlac eholder(), columnBox);
279 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), document().getElementById("spanner1")->renderer()); 279 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), 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")->renderer()), columnBox); 281 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner2")->layoutObject()), columnBox);
282 EXPECT_EQ(document().getElementById("spanner2")->renderer()->spannerPlacehol der(), columnBox); 282 EXPECT_EQ(document().getElementById("spanner2")->layoutObject()->spannerPlac eholder(), columnBox);
283 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), document().getElementById("spanner2")->renderer()); 283 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), document().getElementById("spanner2")->layoutObject());
284 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("outer")->renderer()), nullptr); 284 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("outer")->layoutObject()), nullptr);
285 } 285 }
286 286
287 TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffset) 287 TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffset)
288 { 288 {
289 setMulticolHTML("<div id='mc' style='line-height:100px;'>text<br>text<br>tex t<br>text<br>text<div id='spanner1'>spanner</div>text<br>text<div id='spanner2'> text<br>text</div>text</div>"); 289 setMulticolHTML("<div id='mc' style='line-height:100px;'>text<br>text<br>tex t<br>text<br>text<div id='spanner1'>spanner</div>text<br>text<div id='spanner2'> text<br>text</div>text</div>");
290 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); 290 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
291 EXPECT_EQ(columnSetSignature(flowThread), "cscsc"); 291 EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
292 LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet(); 292 LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
293 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow 293 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow
294 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow); 294 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 351
352 void MultiColumnTreeModifyingTest::setMulticolHTML(const char* html) 352 void MultiColumnTreeModifyingTest::setMulticolHTML(const char* html)
353 { 353 {
354 MultiColumnRenderingTest::setMulticolHTML(html); 354 MultiColumnRenderingTest::setMulticolHTML(html);
355 // Allow modifications to the render tree structure, because that's what we want to test. 355 // Allow modifications to the render tree structure, because that's what we want to test.
356 document().lifecycle().advanceTo(DocumentLifecycle::InStyleRecalc); 356 document().lifecycle().advanceTo(DocumentLifecycle::InStyleRecalc);
357 } 357 }
358 358
359 void MultiColumnTreeModifyingTest::reparentRenderer(const char* newParentId, con st char* childId, const char* insertBeforeId) 359 void MultiColumnTreeModifyingTest::reparentRenderer(const char* newParentId, con st char* childId, const char* insertBeforeId)
360 { 360 {
361 LayoutObject* newParent = document().getElementById(newParentId)->renderer() ; 361 LayoutObject* newParent = document().getElementById(newParentId)->layoutObje ct();
362 LayoutObject* child = document().getElementById(childId)->renderer(); 362 LayoutObject* child = document().getElementById(childId)->layoutObject();
363 LayoutObject* insertBefore = insertBeforeId ? document().getElementById(inse rtBeforeId)->renderer() : 0; 363 LayoutObject* insertBefore = insertBeforeId ? document().getElementById(inse rtBeforeId)->layoutObject() : 0;
364 child->remove(); 364 child->remove();
365 newParent->addChild(child, insertBefore); 365 newParent->addChild(child, insertBefore);
366 } 366 }
367 367
368 void MultiColumnTreeModifyingTest::destroyRenderer(LayoutObject* child) 368 void MultiColumnTreeModifyingTest::destroyRenderer(LayoutObject* child)
369 { 369 {
370 // Remove and destroy in separate steps, so that we get to test removal of s ubtrees. 370 // Remove and destroy in separate steps, so that we get to test removal of s ubtrees.
371 child->remove(); 371 child->remove();
372 child->node()->detach(); 372 child->node()->detach();
373 } 373 }
374 374
375 void MultiColumnTreeModifyingTest::destroyRenderer(const char* childId) 375 void MultiColumnTreeModifyingTest::destroyRenderer(const char* childId)
376 { 376 {
377 destroyRenderer(document().getElementById(childId)->renderer()); 377 destroyRenderer(document().getElementById(childId)->layoutObject());
378 } 378 }
379 379
380 TEST_F(MultiColumnTreeModifyingTest, InsertFirstContentAndRemove) 380 TEST_F(MultiColumnTreeModifyingTest, InsertFirstContentAndRemove)
381 { 381 {
382 setMulticolHTML("<div id='block'></div><div id='mc'></div>"); 382 setMulticolHTML("<div id='block'></div><div id='mc'></div>");
383 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); 383 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
384 LayoutBlockFlow* block = toLayoutBlockFlow(document().getElementById("block" )->renderer()); 384 LayoutBlockFlow* block = toLayoutBlockFlow(document().getElementById("block" )->layoutObject());
385 LayoutBlockFlow* multicolContainer = toLayoutBlockFlow(document().getElement ById("mc")->renderer()); 385 LayoutBlockFlow* multicolContainer = toLayoutBlockFlow(document().getElement ById("mc")->layoutObject());
386 block->remove(); 386 block->remove();
387 multicolContainer->addChild(block); 387 multicolContainer->addChild(block);
388 EXPECT_EQ(block->parent(), flowThread); 388 EXPECT_EQ(block->parent(), flowThread);
389 // A set should have appeared, now that the multicol container has content. 389 // A set should have appeared, now that the multicol container has content.
390 EXPECT_EQ(columnSetSignature(flowThread), "c"); 390 EXPECT_EQ(columnSetSignature(flowThread), "c");
391 391
392 destroyRenderer(block); 392 destroyRenderer(block);
393 // The set should be gone again now, since there's nothing inside the multic ol container anymore. 393 // The set should be gone again now, since there's nothing inside the multic ol container anymore.
394 EXPECT_EQ(columnSetSignature("mc"), ""); 394 EXPECT_EQ(columnSetSignature("mc"), "");
395 } 395 }
(...skipping 19 matching lines...) Expand all
415 EXPECT_EQ(columnSetSignature("mc"), "c"); 415 EXPECT_EQ(columnSetSignature("mc"), "c");
416 destroyRenderer("block"); 416 destroyRenderer("block");
417 // There's still some content after the removal, so the set should remain. 417 // There's still some content after the removal, so the set should remain.
418 EXPECT_EQ(columnSetSignature("mc"), "c"); 418 EXPECT_EQ(columnSetSignature("mc"), "c");
419 } 419 }
420 420
421 TEST_F(MultiColumnTreeModifyingTest, InsertSpannerAndRemove) 421 TEST_F(MultiColumnTreeModifyingTest, InsertSpannerAndRemove)
422 { 422 {
423 setMulticolHTML("<div id='spanner'></div><div id='mc'></div>"); 423 setMulticolHTML("<div id='spanner'></div><div id='mc'></div>");
424 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); 424 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
425 LayoutBlockFlow* spanner = toLayoutBlockFlow(document().getElementById("span ner")->renderer()); 425 LayoutBlockFlow* spanner = toLayoutBlockFlow(document().getElementById("span ner")->layoutObject());
426 LayoutBlockFlow* multicolContainer = toLayoutBlockFlow(document().getElement ById("mc")->renderer()); 426 LayoutBlockFlow* multicolContainer = toLayoutBlockFlow(document().getElement ById("mc")->layoutObject());
427 spanner->remove(); 427 spanner->remove();
428 multicolContainer->addChild(spanner); 428 multicolContainer->addChild(spanner);
429 EXPECT_EQ(spanner->parent(), flowThread); 429 EXPECT_EQ(spanner->parent(), flowThread);
430 // We should now have a spanner placeholder, since we just moved a spanner i nto the multicol container. 430 // We should now have a spanner placeholder, since we just moved a spanner i nto the multicol container.
431 EXPECT_EQ(columnSetSignature(flowThread), "s"); 431 EXPECT_EQ(columnSetSignature(flowThread), "s");
432 destroyRenderer(spanner); 432 destroyRenderer(spanner);
433 EXPECT_EQ(columnSetSignature(flowThread), ""); 433 EXPECT_EQ(columnSetSignature(flowThread), "");
434 } 434 }
435 435
436 TEST_F(MultiColumnTreeModifyingTest, InsertTwoSpannersAndRemove) 436 TEST_F(MultiColumnTreeModifyingTest, InsertTwoSpannersAndRemove)
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 destroyRenderer("spanner"); 800 destroyRenderer("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
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutListItem.cpp ('k') | Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698