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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/DisplayItemListTest.cpp

Issue 2793233002: Remove begin/end subseq. display items, and store on PaintController instead. (Closed)
Patch Set: none Created 3 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "platform/graphics/paint/DisplayItemList.h" 5 #include "platform/graphics/paint/DisplayItemList.h"
6 6
7 #include "SkTypes.h" 7 #include "SkTypes.h"
8 #include "platform/graphics/paint/DrawingDisplayItem.h" 8 #include "platform/graphics/paint/DrawingDisplayItem.h"
9 #include "platform/graphics/paint/PaintFlags.h" 9 #include "platform/graphics/paint/PaintFlags.h"
10 #include "platform/graphics/paint/PaintRecorder.h" 10 #include "platform/graphics/paint/PaintRecorder.h"
11 #include "platform/graphics/paint/SubsequenceDisplayItem.h"
12 #include "platform/graphics/skia/SkiaUtils.h" 11 #include "platform/graphics/skia/SkiaUtils.h"
13 #include "platform/testing/FakeDisplayItemClient.h" 12 #include "platform/testing/FakeDisplayItemClient.h"
14 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
15 14
16 namespace blink { 15 namespace blink {
17 namespace { 16 namespace {
18 17
19 #define EXPECT_RECT_EQ(expected, actual) \ 18 #define EXPECT_RECT_EQ(expected, actual) \
20 do { \ 19 do { \
21 const IntRect& actualRect = actual; \ 20 const IntRect& actualRect = actual; \
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 EXPECT_EQ(static_cast<size_t>(1), m_list.size()); 54 EXPECT_EQ(static_cast<size_t>(1), m_list.size());
56 EXPECT_RECT_EQ(drawingBounds, m_list.visualRect(0)); 55 EXPECT_RECT_EQ(drawingBounds, m_list.visualRect(0));
57 } 56 }
58 57
59 TEST_F(DisplayItemListTest, AppendVisualRect_BlockContainingDrawing) { 58 TEST_F(DisplayItemListTest, AppendVisualRect_BlockContainingDrawing) {
60 // TODO(wkorman): Note the visual rects for the paired begin/end are now 59 // TODO(wkorman): Note the visual rects for the paired begin/end are now
61 // irrelevant as they're overwritten in cc::DisplayItemList when rebuilt to 60 // irrelevant as they're overwritten in cc::DisplayItemList when rebuilt to
62 // represent the union of all drawing display item visual rects between the 61 // represent the union of all drawing display item visual rects between the
63 // pair. We should consider revising Blink's display item list in some form 62 // pair. We should consider revising Blink's display item list in some form
64 // so as to only store visual rects for drawing display items. 63 // so as to only store visual rects for drawing display items.
65
66 IntRect subsequenceBounds(5, 6, 7, 8);
67 m_list.allocateAndConstruct<BeginSubsequenceDisplayItem>(m_client);
68 m_list.appendVisualRect(subsequenceBounds);
69
70 IntRect drawingBounds(5, 6, 1, 1); 64 IntRect drawingBounds(5, 6, 1, 1);
71 m_list.allocateAndConstruct<DrawingDisplayItem>( 65 m_list.allocateAndConstruct<DrawingDisplayItem>(
72 m_client, DisplayItem::Type::kDocumentBackground, 66 m_client, DisplayItem::Type::kDocumentBackground,
73 createRectRecord(drawingBounds), true); 67 createRectRecord(drawingBounds), true);
74 m_list.appendVisualRect(drawingBounds); 68 m_list.appendVisualRect(drawingBounds);
75 69
76 m_list.allocateAndConstruct<EndSubsequenceDisplayItem>(m_client); 70 EXPECT_EQ(static_cast<size_t>(1), m_list.size());
77 m_list.appendVisualRect(subsequenceBounds); 71 EXPECT_RECT_EQ(drawingBounds, m_list.visualRect(0));
78
79 EXPECT_EQ(static_cast<size_t>(3), m_list.size());
80 EXPECT_RECT_EQ(subsequenceBounds, m_list.visualRect(0));
81 EXPECT_RECT_EQ(drawingBounds, m_list.visualRect(1));
82 EXPECT_RECT_EQ(subsequenceBounds, m_list.visualRect(2));
83 } 72 }
84 } // namespace 73 } // namespace
85 } // namespace blink 74 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698