Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(408)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintControllerPaintTest.cpp

Issue 2185933003: Fix issues of display item client cache flags (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix issues of display item client cache flags Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "core/paint/ObjectPaintProperties.h"
11 #include "core/paint/PaintLayerPainter.h" 12 #include "core/paint/PaintLayerPainter.h"
12 #include "platform/graphics/GraphicsContext.h" 13 #include "platform/graphics/GraphicsContext.h"
13 #include "platform/graphics/paint/DrawingDisplayItem.h" 14 #include "platform/graphics/paint/DrawingDisplayItem.h"
14 15
15 namespace blink { 16 namespace blink {
16 17
17 INSTANTIATE_TEST_CASE_P(All, PaintControllerPaintTestForSlimmingPaintV1AndV2, :: testing::Bool()); 18 INSTANTIATE_TEST_CASE_P(All, PaintControllerPaintTestForSlimmingPaintV1AndV2, :: testing::Bool());
18 19
19 TEST_P(PaintControllerPaintTestForSlimmingPaintV1AndV2, FullDocumentPaintingWith Caret) 20 TEST_P(PaintControllerPaintTestForSlimmingPaintV1AndV2, FullDocumentPaintingWith Caret)
20 { 21 {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 LayoutText& newText = *toLayoutText(divBlock.firstChild()); 57 LayoutText& newText = *toLayoutText(divBlock.firstChild());
57 InlineTextBox& newFirstTextBox = *newText.firstTextBox(); 58 InlineTextBox& newFirstTextBox = *newText.firstTextBox();
58 InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox(); 59 InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox();
59 60
60 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 3, 61 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 3,
61 TestDisplayItem(layoutView(), documentBackgroundType), 62 TestDisplayItem(layoutView(), documentBackgroundType),
62 TestDisplayItem(newFirstTextBox, foregroundType), 63 TestDisplayItem(newFirstTextBox, foregroundType),
63 TestDisplayItem(secondTextBox, foregroundType)); 64 TestDisplayItem(secondTextBox, foregroundType));
64 } 65 }
65 66
67 TEST_F(PaintControllerPaintTestForSlimmingPaintV2, ChunkIdClientCacheFlag)
68 {
69 setBodyInnerHTML(
70 "<div id='div' style='width: 200px; height: 200px; opacity: 0.5'>"
chrishtr 2016/07/27 19:18:34 Why does this use case cause cache skipping?
Xianzhu 2016/07/27 19:25:55 This doesn't test cache skipping, but test the isJ
chrishtr 2016/07/27 19:28:25 Why is line 92 indicating that the client cache is
Xianzhu 2016/07/27 19:43:38 Added comment. A client is validly cached only if
71 " <div style='width: 100px; height: 100px; background-color: blue'></di v>"
72 "</div>");
73 PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement() ->layoutObject())->layer();
74 LayoutBlock& div = *toLayoutBlock(getLayoutObjectByElementId("div"));
75 LayoutObject& subDiv = *div.firstChild();
76
77 EXPECT_DISPLAY_LIST(rootPaintController().getDisplayItemList(), 6,
78 TestDisplayItem(layoutView(), documentBackgroundType),
79 TestDisplayItem(htmlLayer, DisplayItem::Subsequence),
80 TestDisplayItem(div, DisplayItem::BeginCompositing),
81 TestDisplayItem(subDiv, backgroundType),
82 TestDisplayItem(div, DisplayItem::EndCompositing),
83 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence));
84
85 const EffectPaintPropertyNode* effectNode = div.objectPaintProperties()->eff ect();
86 EXPECT_EQ(0.5f, effectNode->opacity());
87 const PaintChunk& chunk = rootPaintController().paintChunks()[1];
88 EXPECT_EQ(*div.layer(), chunk.id->client);
89 EXPECT_EQ(effectNode, chunk.properties.effect.get());
90
91 EXPECT_FALSE(div.layer()->isJustCreated());
92 EXPECT_FALSE(rootPaintController().clientCacheIsValid(div));
93 EXPECT_TRUE(rootPaintController().clientCacheIsValid(subDiv));
94 }
95
66 } // namespace blink 96 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698