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

Side by Side Diff: third_party/WebKit/Source/core/paint/TablePainterTest.cpp

Issue 2793233002: Remove begin/end subseq. display items, and store on PaintController instead. (Closed)
Patch Set: none Created 3 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "core/paint/PaintControllerPaintTest.h" 5 #include "core/paint/PaintControllerPaintTest.h"
6 #include "core/paint/PaintLayerPainter.h" 6 #include "core/paint/PaintLayerPainter.h"
7 7
8 // This file contains tests testing TablePainter, TableSectionPainter, 8 // This file contains tests testing TablePainter, TableSectionPainter,
9 // TableRowPainter and TableCellPainter. It's difficult to separate the tests 9 // TableRowPainter and TableCellPainter. It's difficult to separate the tests
10 // into individual files because of dependencies among the painter classes. 10 // into individual files because of dependencies among the painter classes.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 "separate; }" 115 "separate; }"
116 "</style>" 116 "</style>"
117 "<table>" 117 "<table>"
118 " <tr id='row'><td id='cell1'><td id='cell2'></td></tr>" 118 " <tr id='row'><td id='cell1'><td id='cell2'></td></tr>"
119 "</table>"); 119 "</table>");
120 120
121 LayoutView& layoutView = *document().layoutView(); 121 LayoutView& layoutView = *document().layoutView();
122 LayoutObject& cell1 = *getLayoutObjectByElementId("cell1"); 122 LayoutObject& cell1 = *getLayoutObjectByElementId("cell1");
123 LayoutObject& cell2 = *getLayoutObjectByElementId("cell2"); 123 LayoutObject& cell2 = *getLayoutObjectByElementId("cell2");
124 LayoutObject& row = *getLayoutObjectByElementId("row"); 124 LayoutObject& row = *getLayoutObjectByElementId("row");
125 PaintLayer& htmlLayer =
126 *toLayoutBoxModelObject(document().documentElement()->layoutObject())
127 ->layer();
128 125
129 rootPaintController().invalidateAll(); 126 rootPaintController().invalidateAll();
130 document().view()->updateAllLifecyclePhasesExceptPaint(); 127 document().view()->updateAllLifecyclePhasesExceptPaint();
131 // Intersects cell1 and the spacing between cell1 and cell2. 128 // Intersects cell1 and the spacing between cell1 and cell2.
132 IntRect interestRect(200, 0, 200, 200); 129 IntRect interestRect(200, 0, 200, 200);
133 paint(&interestRect); 130 paint(&interestRect);
134 131
135 EXPECT_DISPLAY_LIST( 132 EXPECT_DISPLAY_LIST(
136 rootPaintController().getDisplayItemList(), 7, 133 rootPaintController().getDisplayItemList(), 5,
137 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground), 134 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
138 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
139 TestDisplayItem(row, DisplayItem::kBeginCompositing), 135 TestDisplayItem(row, DisplayItem::kBeginCompositing),
140 TestDisplayItem(row, DisplayItem::kBoxDecorationBackground), 136 TestDisplayItem(row, DisplayItem::kBoxDecorationBackground),
141 TestDisplayItem(cell1, DisplayItem::kBoxDecorationBackground), 137 TestDisplayItem(cell1, DisplayItem::kBoxDecorationBackground),
142 TestDisplayItem(row, DisplayItem::kEndCompositing), 138 TestDisplayItem(row, DisplayItem::kEndCompositing));
143 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
144 139
145 document().view()->updateAllLifecyclePhasesExceptPaint(); 140 document().view()->updateAllLifecyclePhasesExceptPaint();
146 // Intersects the spacing only. 141 // Intersects the spacing only.
147 interestRect = IntRect(300, 0, 100, 100); 142 interestRect = IntRect(300, 0, 100, 100);
148 paint(&interestRect); 143 paint(&interestRect);
149 144
150 EXPECT_DISPLAY_LIST( 145 EXPECT_DISPLAY_LIST(
151 rootPaintController().getDisplayItemList(), 3, 146 rootPaintController().getDisplayItemList(), 1,
152 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground), 147 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground));
153 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
154 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
155 148
156 document().view()->updateAllLifecyclePhasesExceptPaint(); 149 document().view()->updateAllLifecyclePhasesExceptPaint();
157 // Intersects cell2 only. 150 // Intersects cell2 only.
158 interestRect = IntRect(450, 0, 200, 200); 151 interestRect = IntRect(450, 0, 200, 200);
159 paint(&interestRect); 152 paint(&interestRect);
160 153
161 EXPECT_DISPLAY_LIST( 154 EXPECT_DISPLAY_LIST(
162 rootPaintController().getDisplayItemList(), 7, 155 rootPaintController().getDisplayItemList(), 5,
163 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground), 156 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
164 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
165 TestDisplayItem(row, DisplayItem::kBeginCompositing), 157 TestDisplayItem(row, DisplayItem::kBeginCompositing),
166 TestDisplayItem(row, DisplayItem::kBoxDecorationBackground), 158 TestDisplayItem(row, DisplayItem::kBoxDecorationBackground),
167 TestDisplayItem(cell2, DisplayItem::kBoxDecorationBackground), 159 TestDisplayItem(cell2, DisplayItem::kBoxDecorationBackground),
168 TestDisplayItem(row, DisplayItem::kEndCompositing), 160 TestDisplayItem(row, DisplayItem::kEndCompositing));
169 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
170 } 161 }
171 162
172 TEST_F(TablePainterTest, CollapsedBorderAndOverflow) { 163 TEST_F(TablePainterTest, CollapsedBorderAndOverflow) {
173 setBodyInnerHTML( 164 setBodyInnerHTML(
174 "<style>" 165 "<style>"
175 " body { margin: 0 }" 166 " body { margin: 0 }"
176 " td { width: 100px; height: 100px; border: 100px solid blue; outline: " 167 " td { width: 100px; height: 100px; border: 100px solid blue; outline: "
177 "100px solid yellow; background: green; }" 168 "100px solid yellow; background: green; }"
178 " table { margin: 100px; border-collapse: collapse; }" 169 " table { margin: 100px; border-collapse: collapse; }"
179 "</style>" 170 "</style>"
(...skipping 14 matching lines...) Expand all
194 EXPECT_DISPLAY_LIST( 185 EXPECT_DISPLAY_LIST(
195 rootPaintController().getDisplayItemList(), 4, 186 rootPaintController().getDisplayItemList(), 4,
196 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground), 187 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
197 TestDisplayItem(cell, DisplayItem::kBoxDecorationBackground), 188 TestDisplayItem(cell, DisplayItem::kBoxDecorationBackground),
198 TestDisplayItem(cell, DisplayItem::kTableCollapsedBorderLast), 189 TestDisplayItem(cell, DisplayItem::kTableCollapsedBorderLast),
199 TestDisplayItem(cell, DisplayItem::paintPhaseToDrawingType( 190 TestDisplayItem(cell, DisplayItem::paintPhaseToDrawingType(
200 PaintPhaseSelfOutlineOnly))); 191 PaintPhaseSelfOutlineOnly)));
201 } 192 }
202 193
203 } // namespace blink 194 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeUpdateTests.cpp ('k') | third_party/WebKit/Source/platform/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698