| 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>" | |
| 73 "</div>"); | 72 "</div>"); |
| 74 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); | 73 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); |
| 75 LayoutBlock& div = *toLayoutBlock(getLayoutObjectByElementId("div")); | 74 LayoutBlock& div = *toLayoutBlock(getLayoutObjectByElementId("div")); |
| 76 LayoutObject& subDiv = *div.firstChild(); | 75 LayoutObject& subDiv = *div.firstChild(); |
| 77 LayoutObject& subDiv2 = *subDiv.nextSibling(); | 76 |
| 78 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 7, | 77 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 6, |
| 79 TestDisplayItem(layoutView(), documentBackgroundType), | 78 TestDisplayItem(layoutView(), documentBackgroundType), |
| 80 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | 79 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), |
| 81 TestDisplayItem(div, DisplayItem::BeginCompositing), | 80 TestDisplayItem(div, DisplayItem::BeginCompositing), |
| 82 TestDisplayItem(subDiv, backgroundType), | 81 TestDisplayItem(subDiv, backgroundType), |
| 83 TestDisplayItem(subDiv2, backgroundType), | |
| 84 TestDisplayItem(div, DisplayItem::EndCompositing), | 82 TestDisplayItem(div, DisplayItem::EndCompositing), |
| 85 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 83 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); |
| 86 | 84 |
| 87 const EffectPaintPropertyNode* effectNode = div.objectPaintProperties()->eff
ect(); | 85 const EffectPaintPropertyNode* effectNode = div.objectPaintProperties()->eff
ect(); |
| 88 EXPECT_EQ(0.5f, effectNode->opacity()); | 86 EXPECT_EQ(0.5f, effectNode->opacity()); |
| 89 const PaintChunk& chunk = rootPaintController().paintChunks()[1]; | 87 const PaintChunk& chunk = rootPaintController().paintChunks()[1]; |
| 90 EXPECT_EQ(*div.layer(), chunk.id->client); | 88 EXPECT_EQ(*div.layer(), chunk.id->client); |
| 91 EXPECT_EQ(effectNode, chunk.properties.effect.get()); | 89 EXPECT_EQ(effectNode, chunk.properties.effect.get()); |
| 92 | 90 |
| 93 EXPECT_FALSE(div.layer()->isJustCreated()); | 91 EXPECT_FALSE(div.layer()->isJustCreated()); |
| 94 // Client used by only paint chunks and non-cachaeable display items but not
by any | 92 // Client used by only paint chunks and non-cachaeable display items but not
by any |
| 95 // cacheable display items won't be marked as validly cached. | 93 // cacheable display items won't be marked as validly cached. |
| 96 EXPECT_FALSE(rootPaintController().clientCacheIsValid(*div.layer())); | 94 EXPECT_FALSE(rootPaintController().clientCacheIsValid(*div.layer())); |
| 97 EXPECT_FALSE(rootPaintController().clientCacheIsValid(div)); | 95 EXPECT_FALSE(rootPaintController().clientCacheIsValid(div)); |
| 98 EXPECT_TRUE(rootPaintController().clientCacheIsValid(subDiv)); | 96 EXPECT_TRUE(rootPaintController().clientCacheIsValid(subDiv)); |
| 99 } | 97 } |
| 100 | 98 |
| 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 | |
| 120 } // namespace blink | 99 } // namespace blink |
| OLD | NEW |