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

Unified Diff: third_party/WebKit/Source/core/paint/TableCellPainterTest.cpp

Issue 2786463004: Paint backgrounds of a table section/row in one display item (Closed)
Patch Set: - 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/TableCellPainterTest.cpp
diff --git a/third_party/WebKit/Source/core/paint/TableCellPainterTest.cpp b/third_party/WebKit/Source/core/paint/TableCellPainterTest.cpp
deleted file mode 100644
index 085cf1aacff08ba356f0ba6c68b87bc6b6187007..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/core/paint/TableCellPainterTest.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "core/paint/PaintControllerPaintTest.h"
-#include "core/paint/PaintLayerPainter.h"
-
-namespace blink {
-
-using TableCellPainterTest = PaintControllerPaintTest;
-
-TEST_F(TableCellPainterTest, Background) {
- setBodyInnerHTML(
- "<style>"
- " td { width: 200px; height: 200px; border: none; }"
- " tr { background-color: blue; }"
- " table { border: none; border-spacing: 0; border-collapse: collapse; }"
- "</style>"
- "<table>"
- " <tr><td id='cell1'></td></tr>"
- " <tr><td id='cell2'></td></tr>"
- "</table>");
-
- LayoutView& layoutView = *document().layoutView();
- LayoutObject& cell1 = *getLayoutObjectByElementId("cell1");
- LayoutObject& cell2 = *getLayoutObjectByElementId("cell2");
-
- rootPaintController().invalidateAll();
- document().view()->updateAllLifecyclePhasesExceptPaint();
- IntRect interestRect(0, 0, 200, 200);
- paint(&interestRect);
-
- EXPECT_DISPLAY_LIST(
- rootPaintController().getDisplayItemList(), 2,
- TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
- TestDisplayItem(cell1, DisplayItem::kTableCellBackgroundFromRow));
-
- document().view()->updateAllLifecyclePhasesExceptPaint();
- interestRect = IntRect(0, 300, 200, 1000);
- paint(&interestRect);
-
- EXPECT_DISPLAY_LIST(
- rootPaintController().getDisplayItemList(), 2,
- TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
- TestDisplayItem(cell2, DisplayItem::kTableCellBackgroundFromRow));
-}
-
-TEST_F(TableCellPainterTest, BackgroundWithCellSpacing) {
- setBodyInnerHTML(
- "<style>"
- " body { margin: 0; }"
- " td { width: 200px; height: 150px; border: 0; background-color: green; "
- "}"
- " tr { background-color: blue; }"
- " table { border: none; border-spacing: 100px; border-collapse: "
- "separate; }"
- "</style>"
- "<table>"
- " <tr><td id='cell1'></td></tr>"
- " <tr><td id='cell2'></td></tr>"
- "</table>");
-
- LayoutView& layoutView = *document().layoutView();
- LayoutObject& cell1 = *getLayoutObjectByElementId("cell1");
- LayoutObject& cell2 = *getLayoutObjectByElementId("cell2");
-
- rootPaintController().invalidateAll();
- document().view()->updateAllLifecyclePhasesExceptPaint();
- // Intersects cell1 and the spacing between cell1 and cell2.
- IntRect interestRect(0, 200, 200, 150);
- paint(&interestRect);
-
- EXPECT_DISPLAY_LIST(
- rootPaintController().getDisplayItemList(), 3,
- TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
- TestDisplayItem(cell1, DisplayItem::kTableCellBackgroundFromRow),
- TestDisplayItem(cell1, DisplayItem::kBoxDecorationBackground));
-
- document().view()->updateAllLifecyclePhasesExceptPaint();
- // Intersects the spacing only.
- interestRect = IntRect(0, 250, 100, 100);
- paint(&interestRect);
-
- EXPECT_DISPLAY_LIST(
- rootPaintController().getDisplayItemList(), 1,
- TestDisplayItem(layoutView, DisplayItem::kDocumentBackground));
-
- document().view()->updateAllLifecyclePhasesExceptPaint();
- // Intersects cell2 only.
- interestRect = IntRect(0, 350, 200, 150);
- paint(&interestRect);
-
- EXPECT_DISPLAY_LIST(
- rootPaintController().getDisplayItemList(), 3,
- TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
- TestDisplayItem(cell2, DisplayItem::kTableCellBackgroundFromRow),
- TestDisplayItem(cell2, DisplayItem::kBoxDecorationBackground));
-}
-
-TEST_F(TableCellPainterTest, BackgroundInSelfPaintingRow) {
- setBodyInnerHTML(
- "<style>"
- " body { margin: 0 }"
- " td { width: 200px; height: 200px; border: 0; background-color: green; "
- "}"
- " tr { background-color: blue; opacity: 0.5; }"
- " table { border: none; border-spacing: 100px; border-collapse: "
- "separate; }"
- "</style>"
- "<table>"
- " <tr id='row'><td id='cell1'><td id='cell2'></td></tr>"
- "</table>");
-
- LayoutView& layoutView = *document().layoutView();
- LayoutObject& cell1 = *getLayoutObjectByElementId("cell1");
- LayoutObject& cell2 = *getLayoutObjectByElementId("cell2");
- LayoutObject& row = *getLayoutObjectByElementId("row");
- PaintLayer& htmlLayer =
- *toLayoutBoxModelObject(document().documentElement()->layoutObject())
- ->layer();
-
- rootPaintController().invalidateAll();
- document().view()->updateAllLifecyclePhasesExceptPaint();
- // Intersects cell1 and the spacing between cell1 and cell2.
- IntRect interestRect(200, 0, 200, 200);
- paint(&interestRect);
-
- EXPECT_DISPLAY_LIST(
- rootPaintController().getDisplayItemList(), 7,
- TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
- TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
- TestDisplayItem(row, DisplayItem::kBeginCompositing),
- TestDisplayItem(cell1, DisplayItem::kTableCellBackgroundFromRow),
- TestDisplayItem(cell1, DisplayItem::kBoxDecorationBackground),
- TestDisplayItem(row, DisplayItem::kEndCompositing),
- TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
-
- document().view()->updateAllLifecyclePhasesExceptPaint();
- // Intersects the spacing only.
- interestRect = IntRect(300, 0, 100, 100);
- paint(&interestRect);
-
- EXPECT_DISPLAY_LIST(
- rootPaintController().getDisplayItemList(), 3,
- TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
- TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
- TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
-
- document().view()->updateAllLifecyclePhasesExceptPaint();
- // Intersects cell2 only.
- interestRect = IntRect(450, 0, 200, 200);
- paint(&interestRect);
-
- EXPECT_DISPLAY_LIST(
- rootPaintController().getDisplayItemList(), 7,
- TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
- TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
- TestDisplayItem(row, DisplayItem::kBeginCompositing),
- TestDisplayItem(cell2, DisplayItem::kTableCellBackgroundFromRow),
- TestDisplayItem(cell2, DisplayItem::kBoxDecorationBackground),
- TestDisplayItem(row, DisplayItem::kEndCompositing),
- TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence));
-}
-
-TEST_F(TableCellPainterTest, CollapsedBorderAndOverflow) {
- setBodyInnerHTML(
- "<style>"
- " body { margin: 0 }"
- " td { width: 100px; height: 100px; border: 100px solid blue; outline: "
- "100px solid yellow; background: green; }"
- " table { margin: 100px; border-collapse: collapse; }"
- "</style>"
- "<table>"
- " <tr><td id='cell'></td></tr>"
- "</table>");
-
- LayoutView& layoutView = *document().layoutView();
- LayoutObject& cell = *getLayoutObjectByElementId("cell");
-
- rootPaintController().invalidateAll();
- document().view()->updateAllLifecyclePhasesExceptPaint();
- // Intersects the overflowing part of cell but not border box.
- IntRect interestRect(0, 0, 100, 100);
- paint(&interestRect);
-
- // We should paint all display items of cell.
- EXPECT_DISPLAY_LIST(
- rootPaintController().getDisplayItemList(), 4,
- TestDisplayItem(layoutView, DisplayItem::kDocumentBackground),
- TestDisplayItem(cell, DisplayItem::kBoxDecorationBackground),
- TestDisplayItem(cell, DisplayItem::kTableCollapsedBorderLast),
- TestDisplayItem(cell, DisplayItem::paintPhaseToDrawingType(
- PaintPhaseSelfOutlineOnly)));
-}
-
-} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698