| 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 "core/paint/PaintControllerPaintTest.h" | 6 #include "core/paint/PaintControllerPaintTest.h" |
| 7 | 7 |
| 8 #include "core/layout/LayoutText.h" | 8 #include "core/layout/LayoutText.h" |
| 9 #include "core/layout/line/InlineTextBox.h" | 9 #include "core/layout/line/InlineTextBox.h" |
| 10 #include "core/page/FocusController.h" | 10 #include "core/page/FocusController.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { | 30 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { |
| 31 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 4, | 31 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 4, |
| 32 TestDisplayItem(rootLayer, DisplayItem::Subsequence), | 32 TestDisplayItem(rootLayer, DisplayItem::Subsequence), |
| 33 TestDisplayItem(layoutView(), backgroundType), | 33 TestDisplayItem(layoutView(), backgroundType), |
| 34 TestDisplayItem(textInlineBox, foregroundType), | 34 TestDisplayItem(textInlineBox, foregroundType), |
| 35 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); | 35 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
| 36 } else { | 36 } else { |
| 37 GraphicsContext context(rootPaintController()); | 37 GraphicsContext context(rootPaintController()); |
| 38 PaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 60
0), GlobalPaintNormalPhase, LayoutSize()); | 38 PaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 60
0), GlobalPaintNormalPhase, LayoutSize()); |
| 39 PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo,
PaintLayerPaintingCompositingAllPhases); | 39 PaintLayerPainter(rootLayer).paintLayerContents(context, paintingInfo, P
aintLayerPaintingCompositingAllPhases); |
| 40 rootPaintController().commitNewDisplayItems(); | 40 rootPaintController().commitNewDisplayItems(); |
| 41 | 41 |
| 42 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 2, | 42 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 2, |
| 43 TestDisplayItem(layoutView(), backgroundType), | 43 TestDisplayItem(layoutView(), backgroundType), |
| 44 TestDisplayItem(textInlineBox, foregroundType)); | 44 TestDisplayItem(textInlineBox, foregroundType)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 div.focus(); | 47 div.focus(); |
| 48 document().view()->updateAllLifecyclePhases(); | 48 document().view()->updateAllLifecyclePhases(); |
| 49 | 49 |
| 50 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { | 50 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { |
| 51 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 5, | 51 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 5, |
| 52 TestDisplayItem(rootLayer, DisplayItem::Subsequence), | 52 TestDisplayItem(rootLayer, DisplayItem::Subsequence), |
| 53 TestDisplayItem(layoutView(), backgroundType), | 53 TestDisplayItem(layoutView(), backgroundType), |
| 54 TestDisplayItem(textInlineBox, foregroundType), | 54 TestDisplayItem(textInlineBox, foregroundType), |
| 55 TestDisplayItem(divLayoutObject, DisplayItem::Caret), // New! | 55 TestDisplayItem(divLayoutObject, DisplayItem::Caret), // New! |
| 56 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); | 56 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
| 57 } else { | 57 } else { |
| 58 GraphicsContext context(rootPaintController()); | 58 GraphicsContext context(rootPaintController()); |
| 59 PaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 60
0), GlobalPaintNormalPhase, LayoutSize()); | 59 PaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 60
0), GlobalPaintNormalPhase, LayoutSize()); |
| 60 PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo,
PaintLayerPaintingCompositingAllPhases); | 60 PaintLayerPainter(rootLayer).paintLayerContents(context, paintingInfo, P
aintLayerPaintingCompositingAllPhases); |
| 61 rootPaintController().commitNewDisplayItems(); | 61 rootPaintController().commitNewDisplayItems(); |
| 62 | 62 |
| 63 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 3, | 63 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 3, |
| 64 TestDisplayItem(layoutView(), backgroundType), | 64 TestDisplayItem(layoutView(), backgroundType), |
| 65 TestDisplayItem(textInlineBox, foregroundType), | 65 TestDisplayItem(textInlineBox, foregroundType), |
| 66 TestDisplayItem(divLayoutObject, DisplayItem::Caret)); // New! | 66 TestDisplayItem(divLayoutObject, DisplayItem::Caret)); // New! |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 TEST_P(PaintControllerPaintTestForSlimmingPaintV1AndV2, InlineRelayout) | 70 TEST_P(PaintControllerPaintTestForSlimmingPaintV1AndV2, InlineRelayout) |
| 71 { | 71 { |
| 72 setBodyInnerHTML("<div id='div' style='width:100px; height: 200px'>AAAAAAAAA
A BBBBBBBBBB</div>"); | 72 setBodyInnerHTML("<div id='div' style='width:100px; height: 200px'>AAAAAAAAA
A BBBBBBBBBB</div>"); |
| 73 PaintLayer& rootLayer = *layoutView().layer(); | 73 PaintLayer& rootLayer = *layoutView().layer(); |
| 74 Element& div = *toElement(document().body()->firstChild()); | 74 Element& div = *toElement(document().body()->firstChild()); |
| 75 LayoutBlock& divBlock = *toLayoutBlock(document().body()->firstChild()->layo
utObject()); | 75 LayoutBlock& divBlock = *toLayoutBlock(document().body()->firstChild()->layo
utObject()); |
| 76 LayoutText& text = *toLayoutText(divBlock.firstChild()); | 76 LayoutText& text = *toLayoutText(divBlock.firstChild()); |
| 77 InlineTextBox& firstTextBox = *text.firstTextBox(); | 77 InlineTextBox& firstTextBox = *text.firstTextBox(); |
| 78 | 78 |
| 79 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { | 79 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { |
| 80 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 4, | 80 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 4, |
| 81 TestDisplayItem(rootLayer, DisplayItem::Subsequence), | 81 TestDisplayItem(rootLayer, DisplayItem::Subsequence), |
| 82 TestDisplayItem(layoutView(), backgroundType), | 82 TestDisplayItem(layoutView(), backgroundType), |
| 83 TestDisplayItem(firstTextBox, foregroundType), | 83 TestDisplayItem(firstTextBox, foregroundType), |
| 84 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); | 84 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
| 85 } else { | 85 } else { |
| 86 GraphicsContext context(rootPaintController()); | 86 GraphicsContext context(rootPaintController()); |
| 87 PaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 60
0), GlobalPaintNormalPhase, LayoutSize()); | 87 PaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 60
0), GlobalPaintNormalPhase, LayoutSize()); |
| 88 PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo,
PaintLayerPaintingCompositingAllPhases); | 88 PaintLayerPainter(rootLayer).paintLayerContents(context, paintingInfo, P
aintLayerPaintingCompositingAllPhases); |
| 89 rootPaintController().commitNewDisplayItems(); | 89 rootPaintController().commitNewDisplayItems(); |
| 90 | 90 |
| 91 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 2, | 91 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 2, |
| 92 TestDisplayItem(layoutView(), backgroundType), | 92 TestDisplayItem(layoutView(), backgroundType), |
| 93 TestDisplayItem(firstTextBox, foregroundType)); | 93 TestDisplayItem(firstTextBox, foregroundType)); |
| 94 } | 94 } |
| 95 | 95 |
| 96 div.setAttribute(HTMLNames::styleAttr, "width: 10px; height: 200px"); | 96 div.setAttribute(HTMLNames::styleAttr, "width: 10px; height: 200px"); |
| 97 document().view()->updateAllLifecyclePhases(); | 97 document().view()->updateAllLifecyclePhases(); |
| 98 | 98 |
| 99 LayoutText& newText = *toLayoutText(divBlock.firstChild()); | 99 LayoutText& newText = *toLayoutText(divBlock.firstChild()); |
| 100 InlineTextBox& newFirstTextBox = *newText.firstTextBox(); | 100 InlineTextBox& newFirstTextBox = *newText.firstTextBox(); |
| 101 InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox(); | 101 InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox(); |
| 102 | 102 |
| 103 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { | 103 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { |
| 104 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 5, | 104 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 5, |
| 105 TestDisplayItem(rootLayer, DisplayItem::Subsequence), | 105 TestDisplayItem(rootLayer, DisplayItem::Subsequence), |
| 106 TestDisplayItem(layoutView(), backgroundType), | 106 TestDisplayItem(layoutView(), backgroundType), |
| 107 TestDisplayItem(newFirstTextBox, foregroundType), | 107 TestDisplayItem(newFirstTextBox, foregroundType), |
| 108 TestDisplayItem(secondTextBox, foregroundType), | 108 TestDisplayItem(secondTextBox, foregroundType), |
| 109 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); | 109 TestDisplayItem(rootLayer, DisplayItem::EndSubsequence)); |
| 110 } else { | 110 } else { |
| 111 GraphicsContext context(rootPaintController()); | 111 GraphicsContext context(rootPaintController()); |
| 112 PaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 60
0), GlobalPaintNormalPhase, LayoutSize()); | 112 PaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 60
0), GlobalPaintNormalPhase, LayoutSize()); |
| 113 PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo,
PaintLayerPaintingCompositingAllPhases); | 113 PaintLayerPainter(rootLayer).paintLayerContents(context, paintingInfo, P
aintLayerPaintingCompositingAllPhases); |
| 114 rootPaintController().commitNewDisplayItems(); | 114 rootPaintController().commitNewDisplayItems(); |
| 115 | 115 |
| 116 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 3, | 116 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 3, |
| 117 TestDisplayItem(layoutView(), backgroundType), | 117 TestDisplayItem(layoutView(), backgroundType), |
| 118 TestDisplayItem(newFirstTextBox, foregroundType), | 118 TestDisplayItem(newFirstTextBox, foregroundType), |
| 119 TestDisplayItem(secondTextBox, foregroundType)); | 119 TestDisplayItem(secondTextBox, foregroundType)); |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace blink | 123 } // namespace blink |
| OLD | NEW |