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

Side by Side Diff: third_party/WebKit/Source/core/paint/TableCellPainterTest.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 namespace blink { 8 namespace blink {
9 9
10 using TableCellPainterTest = PaintControllerPaintTest; 10 using TableCellPainterTest = PaintControllerPaintTest;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 "separate; }" 108 "separate; }"
109 "</style>" 109 "</style>"
110 "<table>" 110 "<table>"
111 " <tr id='row'><td id='cell1'><td id='cell2'></td></tr>" 111 " <tr id='row'><td id='cell1'><td id='cell2'></td></tr>"
112 "</table>"); 112 "</table>");
113 113
114 LayoutView& layoutView = *document().layoutView(); 114 LayoutView& layoutView = *document().layoutView();
115 LayoutObject& cell1 = *getLayoutObjectByElementId("cell1"); 115 LayoutObject& cell1 = *getLayoutObjectByElementId("cell1");
116 LayoutObject& cell2 = *getLayoutObjectByElementId("cell2"); 116 LayoutObject& cell2 = *getLayoutObjectByElementId("cell2");
117 LayoutObject& row = *getLayoutObjectByElementId("row"); 117 LayoutObject& row = *getLayoutObjectByElementId("row");
118 PaintLayer& htmlLayer =
119 *toLayoutBoxModelObject(document().documentElement()->layoutObject())
120 ->layer();
121 118
122 rootPaintController().invalidateAll(); 119 rootPaintController().invalidateAll();
123 document().view()->updateAllLifecyclePhasesExceptPaint(); 120 document().view()->updateAllLifecyclePhasesExceptPaint();
124 // Intersects cell1 and the spacing between cell1 and cell2. 121 // Intersects cell1 and the spacing between cell1 and cell2.
125 IntRect interestRect(200, 0, 200, 200); 122 IntRect interestRect(200, 0, 200, 200);
126 paint(&interestRect); 123 paint(&interestRect);
127 124
128 EXPECT_DISPLAY_LIST( 125 EXPECT_DISPLAY_LIST(
129 rootPaintController().getDisplayItemList(), 7, 126 rootPaintController().getDisplayItemList(), 5,
130 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground), 127 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
131 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
132 TestDisplayItem(row, DisplayItem::kBeginCompositing), 128 TestDisplayItem(row, DisplayItem::kBeginCompositing),
133 TestDisplayItem(cell1, DisplayItem::kTableCellBackgroundFromRow), 129 TestDisplayItem(cell1, DisplayItem::kTableCellBackgroundFromRow),
134 TestDisplayItem(cell1, DisplayItem::kBoxDecorationBackground), 130 TestDisplayItem(cell1, DisplayItem::kBoxDecorationBackground),
135 TestDisplayItem(row, DisplayItem::kEndCompositing), 131 TestDisplayItem(row, DisplayItem::kEndCompositing));
136 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
137 132
138 document().view()->updateAllLifecyclePhasesExceptPaint(); 133 document().view()->updateAllLifecyclePhasesExceptPaint();
139 // Intersects the spacing only. 134 // Intersects the spacing only.
140 interestRect = IntRect(300, 0, 100, 100); 135 interestRect = IntRect(300, 0, 100, 100);
141 paint(&interestRect); 136 paint(&interestRect);
142 137
143 EXPECT_DISPLAY_LIST( 138 EXPECT_DISPLAY_LIST(
144 rootPaintController().getDisplayItemList(), 3, 139 rootPaintController().getDisplayItemList(), 1,
145 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground), 140 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground));
146 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
147 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
148 141
149 document().view()->updateAllLifecyclePhasesExceptPaint(); 142 document().view()->updateAllLifecyclePhasesExceptPaint();
150 // Intersects cell2 only. 143 // Intersects cell2 only.
151 interestRect = IntRect(450, 0, 200, 200); 144 interestRect = IntRect(450, 0, 200, 200);
152 paint(&interestRect); 145 paint(&interestRect);
153 146
154 EXPECT_DISPLAY_LIST( 147 EXPECT_DISPLAY_LIST(
155 rootPaintController().getDisplayItemList(), 7, 148 rootPaintController().getDisplayItemList(), 5,
156 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground), 149 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
157 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
158 TestDisplayItem(row, DisplayItem::kBeginCompositing), 150 TestDisplayItem(row, DisplayItem::kBeginCompositing),
159 TestDisplayItem(cell2, DisplayItem::kTableCellBackgroundFromRow), 151 TestDisplayItem(cell2, DisplayItem::kTableCellBackgroundFromRow),
160 TestDisplayItem(cell2, DisplayItem::kBoxDecorationBackground), 152 TestDisplayItem(cell2, DisplayItem::kBoxDecorationBackground),
161 TestDisplayItem(row, DisplayItem::kEndCompositing), 153 TestDisplayItem(row, DisplayItem::kEndCompositing));
162 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
163 } 154 }
164 155
165 TEST_F(TableCellPainterTest, CollapsedBorderAndOverflow) { 156 TEST_F(TableCellPainterTest, CollapsedBorderAndOverflow) {
166 setBodyInnerHTML( 157 setBodyInnerHTML(
167 "<style>" 158 "<style>"
168 " body { margin: 0 }" 159 " body { margin: 0 }"
169 " td { width: 100px; height: 100px; border: 100px solid blue; outline: " 160 " td { width: 100px; height: 100px; border: 100px solid blue; outline: "
170 "100px solid yellow; background: green; }" 161 "100px solid yellow; background: green; }"
171 " table { margin: 100px; border-collapse: collapse; }" 162 " table { margin: 100px; border-collapse: collapse; }"
172 "</style>" 163 "</style>"
(...skipping 14 matching lines...) Expand all
187 EXPECT_DISPLAY_LIST( 178 EXPECT_DISPLAY_LIST(
188 rootPaintController().getDisplayItemList(), 4, 179 rootPaintController().getDisplayItemList(), 4,
189 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground), 180 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
190 TestDisplayItem(cell, DisplayItem::kBoxDecorationBackground), 181 TestDisplayItem(cell, DisplayItem::kBoxDecorationBackground),
191 TestDisplayItem(cell, DisplayItem::kTableCollapsedBorderLast), 182 TestDisplayItem(cell, DisplayItem::kTableCollapsedBorderLast),
192 TestDisplayItem(cell, DisplayItem::paintPhaseToDrawingType( 183 TestDisplayItem(cell, DisplayItem::paintPhaseToDrawingType(
193 PaintPhaseSelfOutlineOnly))); 184 PaintPhaseSelfOutlineOnly)));
194 } 185 }
195 186
196 } // namespace blink 187 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698