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

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

Issue 2286843002: Rename DisplayItem::Type enum constants to Chromium style. (Closed)
Patch Set: Rebasing... Created 4 years, 3 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 14 matching lines...) Expand all
25 LayoutView& layoutView = *document().layoutView(); 25 LayoutView& layoutView = *document().layoutView();
26 LayoutObject& cell1 = *getLayoutObjectByElementId("cell1"); 26 LayoutObject& cell1 = *getLayoutObjectByElementId("cell1");
27 LayoutObject& cell2 = *getLayoutObjectByElementId("cell2"); 27 LayoutObject& cell2 = *getLayoutObjectByElementId("cell2");
28 28
29 rootPaintController().invalidateAll(); 29 rootPaintController().invalidateAll();
30 document().view()->updateAllLifecyclePhasesExceptPaint(); 30 document().view()->updateAllLifecyclePhasesExceptPaint();
31 IntRect interestRect(0, 0, 200, 200); 31 IntRect interestRect(0, 0, 200, 200);
32 paint(&interestRect); 32 paint(&interestRect);
33 33
34 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 2, 34 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 2,
35 TestDisplayItem(layoutView, DisplayItem::DocumentBackground), 35 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
36 TestDisplayItem(cell1, DisplayItem::TableCellBackgroundFromRow)); 36 TestDisplayItem(cell1, DisplayItem::kTableCellBackgroundFromRow));
37 37
38 document().view()->updateAllLifecyclePhasesExceptPaint(); 38 document().view()->updateAllLifecyclePhasesExceptPaint();
39 interestRect = IntRect(0, 300, 200, 1000); 39 interestRect = IntRect(0, 300, 200, 1000);
40 paint(&interestRect); 40 paint(&interestRect);
41 41
42 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 2, 42 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 2,
43 TestDisplayItem(layoutView, DisplayItem::DocumentBackground), 43 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
44 TestDisplayItem(cell2, DisplayItem::TableCellBackgroundFromRow)); 44 TestDisplayItem(cell2, DisplayItem::kTableCellBackgroundFromRow));
45 } 45 }
46 46
47 TEST_F(TableCellPainterTest, BackgroundWithCellSpacing) 47 TEST_F(TableCellPainterTest, BackgroundWithCellSpacing)
48 { 48 {
49 setBodyInnerHTML( 49 setBodyInnerHTML(
50 "<style>" 50 "<style>"
51 " body { margin: 0; }" 51 " body { margin: 0; }"
52 " td { width: 200px; height: 200px; border: 0; background-color: green; }" 52 " td { width: 200px; height: 200px; border: 0; background-color: green; }"
53 " tr { background-color: blue; }" 53 " tr { background-color: blue; }"
54 " table { border: none; border-spacing: 100px; border-collapse: separat e; }" 54 " table { border: none; border-spacing: 100px; border-collapse: separat e; }"
55 "</style>" 55 "</style>"
56 "<table>" 56 "<table>"
57 " <tr><td id='cell1'></td></tr>" 57 " <tr><td id='cell1'></td></tr>"
58 " <tr><td id='cell2'></td></tr>" 58 " <tr><td id='cell2'></td></tr>"
59 "</table>"); 59 "</table>");
60 60
61 LayoutView& layoutView = *document().layoutView(); 61 LayoutView& layoutView = *document().layoutView();
62 LayoutObject& cell1 = *getLayoutObjectByElementId("cell1"); 62 LayoutObject& cell1 = *getLayoutObjectByElementId("cell1");
63 LayoutObject& cell2 = *getLayoutObjectByElementId("cell2"); 63 LayoutObject& cell2 = *getLayoutObjectByElementId("cell2");
64 64
65 rootPaintController().invalidateAll(); 65 rootPaintController().invalidateAll();
66 document().view()->updateAllLifecyclePhasesExceptPaint(); 66 document().view()->updateAllLifecyclePhasesExceptPaint();
67 // Intersects cell1 and the spacing between cell1 and cell2. 67 // Intersects cell1 and the spacing between cell1 and cell2.
68 IntRect interestRect(0, 200, 200, 200); 68 IntRect interestRect(0, 200, 200, 200);
69 paint(&interestRect); 69 paint(&interestRect);
70 70
71 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 3, 71 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 3,
72 TestDisplayItem(layoutView, DisplayItem::DocumentBackground), 72 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
73 TestDisplayItem(cell1, DisplayItem::TableCellBackgroundFromRow), 73 TestDisplayItem(cell1, DisplayItem::kTableCellBackgroundFromRow),
74 TestDisplayItem(cell1, DisplayItem::BoxDecorationBackground)); 74 TestDisplayItem(cell1, DisplayItem::kBoxDecorationBackground));
75 75
76 document().view()->updateAllLifecyclePhasesExceptPaint(); 76 document().view()->updateAllLifecyclePhasesExceptPaint();
77 // Intersects the spacing only. 77 // Intersects the spacing only.
78 interestRect = IntRect(0, 300, 100, 100); 78 interestRect = IntRect(0, 300, 100, 100);
79 paint(&interestRect); 79 paint(&interestRect);
80 80
81 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 1, 81 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 1,
82 TestDisplayItem(layoutView, DisplayItem::DocumentBackground)); 82 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground));
83 83
84 document().view()->updateAllLifecyclePhasesExceptPaint(); 84 document().view()->updateAllLifecyclePhasesExceptPaint();
85 // Intersects cell2 only. 85 // Intersects cell2 only.
86 interestRect = IntRect(0, 400, 200, 200); 86 interestRect = IntRect(0, 400, 200, 200);
87 paint(&interestRect); 87 paint(&interestRect);
88 88
89 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 3, 89 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 3,
90 TestDisplayItem(layoutView, DisplayItem::DocumentBackground), 90 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
91 TestDisplayItem(cell2, DisplayItem::TableCellBackgroundFromRow), 91 TestDisplayItem(cell2, DisplayItem::kTableCellBackgroundFromRow),
92 TestDisplayItem(cell2, DisplayItem::BoxDecorationBackground)); 92 TestDisplayItem(cell2, DisplayItem::kBoxDecorationBackground));
93 } 93 }
94 94
95 TEST_F(TableCellPainterTest, BackgroundInSelfPaintingRow) 95 TEST_F(TableCellPainterTest, BackgroundInSelfPaintingRow)
96 { 96 {
97 setBodyInnerHTML( 97 setBodyInnerHTML(
98 "<style>" 98 "<style>"
99 " body { margin: 0 }" 99 " body { margin: 0 }"
100 " td { width: 200px; height: 200px; border: 0; background-color: green; }" 100 " td { width: 200px; height: 200px; border: 0; background-color: green; }"
101 " tr { background-color: blue; opacity: 0.5; }" 101 " tr { background-color: blue; opacity: 0.5; }"
102 " table { border: none; border-spacing: 100px; border-collapse: separat e; }" 102 " table { border: none; border-spacing: 100px; border-collapse: separat e; }"
103 "</style>" 103 "</style>"
104 "<table>" 104 "<table>"
105 " <tr id='row'><td id='cell1'><td id='cell2'></td></tr>" 105 " <tr id='row'><td id='cell1'><td id='cell2'></td></tr>"
106 "</table>"); 106 "</table>");
107 107
108 LayoutView& layoutView = *document().layoutView(); 108 LayoutView& layoutView = *document().layoutView();
109 LayoutObject& cell1 = *getLayoutObjectByElementId("cell1"); 109 LayoutObject& cell1 = *getLayoutObjectByElementId("cell1");
110 LayoutObject& cell2 = *getLayoutObjectByElementId("cell2"); 110 LayoutObject& cell2 = *getLayoutObjectByElementId("cell2");
111 LayoutObject& row = *getLayoutObjectByElementId("row"); 111 LayoutObject& row = *getLayoutObjectByElementId("row");
112 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement() ->layoutObject())->layer(); 112 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement() ->layoutObject())->layer();
113 113
114 rootPaintController().invalidateAll(); 114 rootPaintController().invalidateAll();
115 document().view()->updateAllLifecyclePhasesExceptPaint(); 115 document().view()->updateAllLifecyclePhasesExceptPaint();
116 // Intersects cell1 and the spacing between cell1 and cell2. 116 // Intersects cell1 and the spacing between cell1 and cell2.
117 IntRect interestRect(200, 0, 200, 200); 117 IntRect interestRect(200, 0, 200, 200);
118 paint(&interestRect); 118 paint(&interestRect);
119 119
120 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 7, 120 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 7,
121 TestDisplayItem(layoutView, DisplayItem::DocumentBackground), 121 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
122 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), 122 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
123 TestDisplayItem(row, DisplayItem::BeginCompositing), 123 TestDisplayItem(row, DisplayItem::kBeginCompositing),
124 TestDisplayItem(cell1, DisplayItem::TableCellBackgroundFromRow), 124 TestDisplayItem(cell1, DisplayItem::kTableCellBackgroundFromRow),
125 TestDisplayItem(cell1, DisplayItem::BoxDecorationBackground), 125 TestDisplayItem(cell1, DisplayItem::kBoxDecorationBackground),
126 TestDisplayItem(row, DisplayItem::EndCompositing), 126 TestDisplayItem(row, DisplayItem::kEndCompositing),
127 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); 127 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
128 128
129 document().view()->updateAllLifecyclePhasesExceptPaint(); 129 document().view()->updateAllLifecyclePhasesExceptPaint();
130 // Intersects the spacing only. 130 // Intersects the spacing only.
131 interestRect = IntRect(300, 0, 100, 100); 131 interestRect = IntRect(300, 0, 100, 100);
132 paint(&interestRect); 132 paint(&interestRect);
133 133
134 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 3, 134 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 3,
135 TestDisplayItem(layoutView, DisplayItem::DocumentBackground), 135 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
136 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), 136 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
137 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); 137 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
138 138
139 document().view()->updateAllLifecyclePhasesExceptPaint(); 139 document().view()->updateAllLifecyclePhasesExceptPaint();
140 // Intersects cell2 only. 140 // Intersects cell2 only.
141 interestRect = IntRect(450, 0, 200, 200); 141 interestRect = IntRect(450, 0, 200, 200);
142 paint(&interestRect); 142 paint(&interestRect);
143 143
144 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 7, 144 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 7,
145 TestDisplayItem(layoutView, DisplayItem::DocumentBackground), 145 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
146 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), 146 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
147 TestDisplayItem(row, DisplayItem::BeginCompositing), 147 TestDisplayItem(row, DisplayItem::kBeginCompositing),
148 TestDisplayItem(cell2, DisplayItem::TableCellBackgroundFromRow), 148 TestDisplayItem(cell2, DisplayItem::kTableCellBackgroundFromRow),
149 TestDisplayItem(cell2, DisplayItem::BoxDecorationBackground), 149 TestDisplayItem(cell2, DisplayItem::kBoxDecorationBackground),
150 TestDisplayItem(row, DisplayItem::EndCompositing), 150 TestDisplayItem(row, DisplayItem::kEndCompositing),
151 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); 151 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
152 } 152 }
153 153
154 TEST_F(TableCellPainterTest, CollapsedBorderAndOverflow) 154 TEST_F(TableCellPainterTest, CollapsedBorderAndOverflow)
155 { 155 {
156 setBodyInnerHTML( 156 setBodyInnerHTML(
157 "<style>" 157 "<style>"
158 " body { margin: 0 }" 158 " body { margin: 0 }"
159 " td { width: 100px; height: 100px; border: 100px solid blue; outline: 100px solid yellow; background: green; }" 159 " td { width: 100px; height: 100px; border: 100px solid blue; outline: 100px solid yellow; background: green; }"
160 " table { margin: 100px; border-collapse: collapse; }" 160 " table { margin: 100px; border-collapse: collapse; }"
161 "</style>" 161 "</style>"
162 "<table>" 162 "<table>"
163 " <tr><td id='cell'></td></tr>" 163 " <tr><td id='cell'></td></tr>"
164 "</table>"); 164 "</table>");
165 165
166 LayoutView& layoutView = *document().layoutView(); 166 LayoutView& layoutView = *document().layoutView();
167 LayoutObject& cell = *getLayoutObjectByElementId("cell"); 167 LayoutObject& cell = *getLayoutObjectByElementId("cell");
168 168
169 rootPaintController().invalidateAll(); 169 rootPaintController().invalidateAll();
170 document().view()->updateAllLifecyclePhasesExceptPaint(); 170 document().view()->updateAllLifecyclePhasesExceptPaint();
171 // Intersects the overflowing part of cell but not border box. 171 // Intersects the overflowing part of cell but not border box.
172 IntRect interestRect(0, 0, 100, 100); 172 IntRect interestRect(0, 0, 100, 100);
173 paint(&interestRect); 173 paint(&interestRect);
174 174
175 // We should paint all display items of cell. 175 // We should paint all display items of cell.
176 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 4, 176 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 4,
177 TestDisplayItem(layoutView, DisplayItem::DocumentBackground), 177 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
178 TestDisplayItem(cell, DisplayItem::BoxDecorationBackground), 178 TestDisplayItem(cell, DisplayItem::kBoxDecorationBackground),
179 TestDisplayItem(cell, DisplayItem::TableCollapsedBorderLast), 179 TestDisplayItem(cell, DisplayItem::kTableCollapsedBorderLast),
180 TestDisplayItem(cell, DisplayItem::paintPhaseToDrawingType(PaintPhaseSel fOutlineOnly))); 180 TestDisplayItem(cell, DisplayItem::paintPhaseToDrawingType(PaintPhaseSel fOutlineOnly)));
181 } 181 }
182 182
183 } // namespace blink 183 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/TableCellPainter.cpp ('k') | third_party/WebKit/Source/core/paint/TableRowPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698