| 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 18 matching lines...) Expand all Loading... |
| 29 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 2, | 29 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 2, |
| 30 TestDisplayItem(layoutView(), documentBackgroundType), | 30 TestDisplayItem(layoutView(), documentBackgroundType), |
| 31 TestDisplayItem(textInlineBox, foregroundType)); | 31 TestDisplayItem(textInlineBox, foregroundType)); |
| 32 | 32 |
| 33 div.focus(); | 33 div.focus(); |
| 34 document().view()->updateAllLifecyclePhases(); | 34 document().view()->updateAllLifecyclePhases(); |
| 35 | 35 |
| 36 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 3, | 36 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 3, |
| 37 TestDisplayItem(layoutView(), documentBackgroundType), | 37 TestDisplayItem(layoutView(), documentBackgroundType), |
| 38 TestDisplayItem(textInlineBox, foregroundType), | 38 TestDisplayItem(textInlineBox, foregroundType), |
| 39 TestDisplayItem(divLayoutObject, DisplayItem::Caret)); // New! | 39 TestDisplayItem(divLayoutObject, DisplayItem::kCaret)); // New! |
| 40 } | 40 } |
| 41 | 41 |
| 42 TEST_P(PaintControllerPaintTestForSlimmingPaintV1AndV2, InlineRelayout) | 42 TEST_P(PaintControllerPaintTestForSlimmingPaintV1AndV2, InlineRelayout) |
| 43 { | 43 { |
| 44 setBodyInnerHTML("<div id='div' style='width:100px; height: 200px'>AAAAAAAAA
A BBBBBBBBBB</div>"); | 44 setBodyInnerHTML("<div id='div' style='width:100px; height: 200px'>AAAAAAAAA
A BBBBBBBBBB</div>"); |
| 45 Element& div = *toElement(document().body()->firstChild()); | 45 Element& div = *toElement(document().body()->firstChild()); |
| 46 LayoutBlock& divBlock = *toLayoutBlock(document().body()->firstChild()->layo
utObject()); | 46 LayoutBlock& divBlock = *toLayoutBlock(document().body()->firstChild()->layo
utObject()); |
| 47 LayoutText& text = *toLayoutText(divBlock.firstChild()); | 47 LayoutText& text = *toLayoutText(divBlock.firstChild()); |
| 48 InlineTextBox& firstTextBox = *text.firstTextBox(); | 48 InlineTextBox& firstTextBox = *text.firstTextBox(); |
| 49 | 49 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 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 style='width: 100px; height: 100px; background-color: blue'></di
v>" |
| 73 "</div>"); | 73 "</div>"); |
| 74 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); | 74 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); |
| 75 LayoutBlock& div = *toLayoutBlock(getLayoutObjectByElementId("div")); | 75 LayoutBlock& div = *toLayoutBlock(getLayoutObjectByElementId("div")); |
| 76 LayoutObject& subDiv = *div.firstChild(); | 76 LayoutObject& subDiv = *div.firstChild(); |
| 77 LayoutObject& subDiv2 = *subDiv.nextSibling(); | 77 LayoutObject& subDiv2 = *subDiv.nextSibling(); |
| 78 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 7, | 78 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 7, |
| 79 TestDisplayItem(layoutView(), documentBackgroundType), | 79 TestDisplayItem(layoutView(), documentBackgroundType), |
| 80 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | 80 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), |
| 81 TestDisplayItem(div, DisplayItem::BeginCompositing), | 81 TestDisplayItem(div, DisplayItem::kBeginCompositing), |
| 82 TestDisplayItem(subDiv, backgroundType), | 82 TestDisplayItem(subDiv, backgroundType), |
| 83 TestDisplayItem(subDiv2, backgroundType), | 83 TestDisplayItem(subDiv2, backgroundType), |
| 84 TestDisplayItem(div, DisplayItem::EndCompositing), | 84 TestDisplayItem(div, DisplayItem::kEndCompositing), |
| 85 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 85 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence)); |
| 86 | 86 |
| 87 const EffectPaintPropertyNode* effectNode = div.objectPaintProperties()->eff
ect(); | 87 const EffectPaintPropertyNode* effectNode = div.objectPaintProperties()->eff
ect(); |
| 88 EXPECT_EQ(0.5f, effectNode->opacity()); | 88 EXPECT_EQ(0.5f, effectNode->opacity()); |
| 89 const PaintChunk& chunk = rootPaintController().paintChunks()[1]; | 89 const PaintChunk& chunk = rootPaintController().paintChunks()[1]; |
| 90 EXPECT_EQ(*div.layer(), chunk.id->client); | 90 EXPECT_EQ(*div.layer(), chunk.id->client); |
| 91 EXPECT_EQ(effectNode, chunk.properties.effect.get()); | 91 EXPECT_EQ(effectNode, chunk.properties.effect.get()); |
| 92 | 92 |
| 93 EXPECT_FALSE(div.layer()->isJustCreated()); | 93 EXPECT_FALSE(div.layer()->isJustCreated()); |
| 94 // 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 |
| 95 // cacheable display items won't be marked as validly cached. | 95 // cacheable display items won't be marked as validly cached. |
| 96 EXPECT_FALSE(rootPaintController().clientCacheIsValid(*div.layer())); | 96 EXPECT_FALSE(rootPaintController().clientCacheIsValid(*div.layer())); |
| 97 EXPECT_FALSE(rootPaintController().clientCacheIsValid(div)); | 97 EXPECT_FALSE(rootPaintController().clientCacheIsValid(div)); |
| 98 EXPECT_TRUE(rootPaintController().clientCacheIsValid(subDiv)); | 98 EXPECT_TRUE(rootPaintController().clientCacheIsValid(subDiv)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 TEST_F(PaintControllerPaintTestForSlimmingPaintV2, CompositingFold) | 101 TEST_F(PaintControllerPaintTestForSlimmingPaintV2, CompositingFold) |
| 102 { | 102 { |
| 103 setBodyInnerHTML( | 103 setBodyInnerHTML( |
| 104 "<div id='div' style='width: 200px; height: 200px; opacity: 0.5'>" | 104 "<div id='div' style='width: 200px; height: 200px; opacity: 0.5'>" |
| 105 " <div style='width: 100px; height: 100px; background-color: blue'></di
v>" | 105 " <div style='width: 100px; height: 100px; background-color: blue'></di
v>" |
| 106 "</div>"); | 106 "</div>"); |
| 107 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); | 107 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()
->layoutObject())->layer(); |
| 108 LayoutBlock& div = *toLayoutBlock(getLayoutObjectByElementId("div")); | 108 LayoutBlock& div = *toLayoutBlock(getLayoutObjectByElementId("div")); |
| 109 LayoutObject& subDiv = *div.firstChild(); | 109 LayoutObject& subDiv = *div.firstChild(); |
| 110 | 110 |
| 111 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 4, | 111 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 4, |
| 112 TestDisplayItem(layoutView(), documentBackgroundType), | 112 TestDisplayItem(layoutView(), documentBackgroundType), |
| 113 TestDisplayItem(htmlLayer, DisplayItem::Subsequence), | 113 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), |
| 114 // The begin and end compositing display items have been folded into thi
s one. | 114 // The begin and end compositing display items have been folded into thi
s one. |
| 115 TestDisplayItem(subDiv, backgroundType), | 115 TestDisplayItem(subDiv, backgroundType), |
| 116 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 116 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence)); |
| 117 } | 117 } |
| 118 | 118 |
| 119 | 119 |
| 120 } // namespace blink | 120 } // namespace blink |
| OLD | NEW |