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

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

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

Powered by Google App Engine
This is Rietveld 408576698