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 "core/paint/PaintControllerPaintTest.h" | 5 #include "core/paint/PaintControllerPaintTest.h" |
6 | 6 |
7 #include "core/layout/LayoutText.h" | 7 #include "core/layout/LayoutText.h" |
8 #include "core/layout/line/InlineTextBox.h" | 8 #include "core/layout/line/InlineTextBox.h" |
9 #include "core/page/FocusController.h" | 9 #include "core/page/FocusController.h" |
10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 10 #include "core/paint/LayoutObjectDrawingRecorder.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 TestDisplayItem(layoutView(), documentBackgroundType), | 62 TestDisplayItem(layoutView(), documentBackgroundType), |
63 TestDisplayItem(newFirstTextBox, foregroundType), | 63 TestDisplayItem(newFirstTextBox, foregroundType), |
64 TestDisplayItem(secondTextBox, foregroundType)); | 64 TestDisplayItem(secondTextBox, foregroundType)); |
65 } | 65 } |
66 | 66 |
67 TEST_F(PaintControllerPaintTestForSlimmingPaintV2, ChunkIdClientCacheFlag) | 67 TEST_F(PaintControllerPaintTestForSlimmingPaintV2, ChunkIdClientCacheFlag) |
68 { | 68 { |
69 setBodyInnerHTML( | 69 setBodyInnerHTML( |
70 "<div id='div' style='width: 200px; height: 200px; opacity: 0.5'>" | 70 "<div id='div' style='width: 200px; height: 200px; opacity: 0.5'>" |
71 " <div style='width: 100px; height: 100px; background-color: blue'></di
v>" | 71 " <div style='width: 100px; height: 100px; background-color: blue'></di
v>" |
| 72 " <div style='width: 100px; height: 100px; background-color: blue'></di
v>" |
72 "</div>"); | 73 "</div>"); |
73 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); | 74 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); |
74 LayoutBlock& div = *toLayoutBlock(getLayoutObjectByElementId("div")); | 75 LayoutBlock& div = *toLayoutBlock(getLayoutObjectByElementId("div")); |
75 LayoutObject& subDiv = *div.firstChild(); | 76 LayoutObject& subDiv = *div.firstChild(); |
76 | 77 LayoutObject& subDiv2 = *subDiv.nextSibling(); |
77 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 6, | 78 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 7, |
78 TestDisplayItem(layoutView(), documentBackgroundType), | 79 TestDisplayItem(layoutView(), documentBackgroundType), |
79 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | 80 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), |
80 TestDisplayItem(div, DisplayItem::BeginCompositing), | 81 TestDisplayItem(div, DisplayItem::BeginCompositing), |
81 TestDisplayItem(subDiv, backgroundType), | 82 TestDisplayItem(subDiv, backgroundType), |
| 83 TestDisplayItem(subDiv2, backgroundType), |
82 TestDisplayItem(div, DisplayItem::EndCompositing), | 84 TestDisplayItem(div, DisplayItem::EndCompositing), |
83 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 85 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); |
84 | 86 |
85 const EffectPaintPropertyNode* effectNode = div.objectPaintProperties()->eff
ect(); | 87 const EffectPaintPropertyNode* effectNode = div.objectPaintProperties()->eff
ect(); |
86 EXPECT_EQ(0.5f, effectNode->opacity()); | 88 EXPECT_EQ(0.5f, effectNode->opacity()); |
87 const PaintChunk& chunk = rootPaintController().paintChunks()[1]; | 89 const PaintChunk& chunk = rootPaintController().paintChunks()[1]; |
88 EXPECT_EQ(*div.layer(), chunk.id->client); | 90 EXPECT_EQ(*div.layer(), chunk.id->client); |
89 EXPECT_EQ(effectNode, chunk.properties.effect.get()); | 91 EXPECT_EQ(effectNode, chunk.properties.effect.get()); |
90 | 92 |
91 EXPECT_FALSE(div.layer()->isJustCreated()); | 93 EXPECT_FALSE(div.layer()->isJustCreated()); |
92 // Client used by only paint chunks and non-cachaeable display items but not
by any | 94 // Client used by only paint chunks and non-cachaeable display items but not
by any |
93 // cacheable display items won't be marked as validly cached. | 95 // cacheable display items won't be marked as validly cached. |
94 EXPECT_FALSE(rootPaintController().clientCacheIsValid(*div.layer())); | 96 EXPECT_FALSE(rootPaintController().clientCacheIsValid(*div.layer())); |
95 EXPECT_FALSE(rootPaintController().clientCacheIsValid(div)); | 97 EXPECT_FALSE(rootPaintController().clientCacheIsValid(div)); |
96 EXPECT_TRUE(rootPaintController().clientCacheIsValid(subDiv)); | 98 EXPECT_TRUE(rootPaintController().clientCacheIsValid(subDiv)); |
97 } | 99 } |
98 | 100 |
| 101 TEST_F(PaintControllerPaintTestForSlimmingPaintV2, CompositingFold) |
| 102 { |
| 103 setBodyInnerHTML( |
| 104 "<div id='div' style='width: 200px; height: 200px; opacity: 0.5'>" |
| 105 " <div style='width: 100px; height: 100px; background-color: blue'></di
v>" |
| 106 "</div>"); |
| 107 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); |
| 108 LayoutBlock& div = *toLayoutBlock(getLayoutObjectByElementId("div")); |
| 109 LayoutObject& subDiv = *div.firstChild(); |
| 110 |
| 111 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 4, |
| 112 TestDisplayItem(layoutView(), documentBackgroundType), |
| 113 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), |
| 114 // The begin and end compositing display items have been folded into thi
s one. |
| 115 TestDisplayItem(subDiv, backgroundType), |
| 116 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); |
| 117 } |
| 118 |
| 119 |
99 } // namespace blink | 120 } // namespace blink |
OLD | NEW |