| OLD | NEW |
| 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 #include "platform/graphics/paint/DisplayItemList.h" | 6 #include "platform/graphics/paint/DisplayItemList.h" |
| 7 | 7 |
| 8 #include "core/layout/LayoutTestHelper.h" | 8 #include "core/layout/LayoutTestHelper.h" |
| 9 #include "core/layout/LayoutText.h" | 9 #include "core/layout/LayoutText.h" |
| 10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 GraphicsContext context(&rootDisplayItemList()); | 98 GraphicsContext context(&rootDisplayItemList()); |
| 99 DeprecatedPaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 8
00, 600), PaintBehaviorNormal, LayoutSize()); | 99 DeprecatedPaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 8
00, 600), PaintBehaviorNormal, LayoutSize()); |
| 100 DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, painting
Info, PaintLayerPaintingCompositingAllPhases); | 100 DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, painting
Info, PaintLayerPaintingCompositingAllPhases); |
| 101 rootDisplayItemList().commitNewDisplayItems(); | 101 rootDisplayItemList().commitNewDisplayItems(); |
| 102 | 102 |
| 103 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 2, | 103 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 2, |
| 104 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), | 104 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), |
| 105 TestDisplayItem(textInlineBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground))); | 105 TestDisplayItem(textInlineBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground))); |
| 106 | 106 |
| 107 div.focus(); | 107 div.focus(); |
| 108 document().view()->updateLayoutAndStyleForPainting(); | 108 document().view()->updateAllLifecyclePhases(); |
| 109 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(layoutView.displayItemC
lient())); | 109 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(layoutView.displayItemC
lient())); |
| 110 EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(divLayoutObject.displa
yItemClient())); | 110 EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(divLayoutObject.displa
yItemClient())); |
| 111 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(textInlineBox.displayIt
emClient())); | 111 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(textInlineBox.displayIt
emClient())); |
| 112 DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, painting
Info, PaintLayerPaintingCompositingAllPhases); | 112 DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, painting
Info, PaintLayerPaintingCompositingAllPhases); |
| 113 rootDisplayItemList().commitNewDisplayItems(); | 113 rootDisplayItemList().commitNewDisplayItems(); |
| 114 | 114 |
| 115 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 3, | 115 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 3, |
| 116 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), | 116 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), |
| 117 TestDisplayItem(textInlineBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground)), | 117 TestDisplayItem(textInlineBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground)), |
| 118 TestDisplayItem(divLayoutObject, DisplayItem::Caret)); // New! | 118 TestDisplayItem(divLayoutObject, DisplayItem::Caret)); // New! |
| (...skipping 13 matching lines...) Expand all Loading... |
| 132 GraphicsContext context(&rootDisplayItemList()); | 132 GraphicsContext context(&rootDisplayItemList()); |
| 133 DeprecatedPaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 8
00, 600), PaintBehaviorNormal, LayoutSize()); | 133 DeprecatedPaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 8
00, 600), PaintBehaviorNormal, LayoutSize()); |
| 134 DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, painting
Info, PaintLayerPaintingCompositingAllPhases); | 134 DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, painting
Info, PaintLayerPaintingCompositingAllPhases); |
| 135 rootDisplayItemList().commitNewDisplayItems(); | 135 rootDisplayItemList().commitNewDisplayItems(); |
| 136 | 136 |
| 137 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 2, | 137 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 2, |
| 138 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), | 138 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), |
| 139 TestDisplayItem(firstTextBox, DisplayItem::paintPhaseToDrawingType(Paint
PhaseForeground))); | 139 TestDisplayItem(firstTextBox, DisplayItem::paintPhaseToDrawingType(Paint
PhaseForeground))); |
| 140 | 140 |
| 141 div.setAttribute(HTMLNames::styleAttr, "width: 10px; height: 200px"); | 141 div.setAttribute(HTMLNames::styleAttr, "width: 10px; height: 200px"); |
| 142 document().view()->updateLayoutAndStyleForPainting(); | 142 document().view()->updateAllLifecyclePhases(); |
| 143 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(layoutView.displayItemC
lient())); | 143 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(layoutView.displayItemC
lient())); |
| 144 EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(divBlock.displayItemCl
ient())); | 144 EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(divBlock.displayItemCl
ient())); |
| 145 EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(firstTextBoxDisplayIte
mClient)); | 145 EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(firstTextBoxDisplayIte
mClient)); |
| 146 DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, painting
Info, PaintLayerPaintingCompositingAllPhases); | 146 DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, painting
Info, PaintLayerPaintingCompositingAllPhases); |
| 147 rootDisplayItemList().commitNewDisplayItems(); | 147 rootDisplayItemList().commitNewDisplayItems(); |
| 148 | 148 |
| 149 LayoutText& newText = *toLayoutText(divBlock.firstChild()); | 149 LayoutText& newText = *toLayoutText(divBlock.firstChild()); |
| 150 InlineTextBox& newFirstTextBox = *newText.firstTextBox(); | 150 InlineTextBox& newFirstTextBox = *newText.firstTextBox(); |
| 151 InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox(); | 151 InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox(); |
| 152 | 152 |
| 153 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 3, | 153 EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 3, |
| 154 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), | 154 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), |
| 155 TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground)), | 155 TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(Pa
intPhaseForeground)), |
| 156 TestDisplayItem(secondTextBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground))); | 156 TestDisplayItem(secondTextBox, DisplayItem::paintPhaseToDrawingType(Pain
tPhaseForeground))); |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace blink | 159 } // namespace blink |
| OLD | NEW |