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

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

Issue 2286843002: Rename DisplayItem::Type enum constants to Chromium style. (Closed)
Patch Set: Rebasing... Created 4 years, 3 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 "SkPictureRecorder.h" 7 #include "SkPictureRecorder.h"
8 #include "SkTypes.h" 8 #include "SkTypes.h"
9 #include "platform/graphics/paint/DrawingDisplayItem.h" 9 #include "platform/graphics/paint/DrawingDisplayItem.h"
10 #include "platform/graphics/paint/SubsequenceDisplayItem.h" 10 #include "platform/graphics/paint/SubsequenceDisplayItem.h"
(...skipping 30 matching lines...) Expand all
41 SkCanvas* canvas = recorder.beginRecording(bounds.width(), bounds.height()); 41 SkCanvas* canvas = recorder.beginRecording(bounds.width(), bounds.height());
42 canvas->drawRect(SkRect::MakeXYWH(bounds.x(), bounds.y(), bounds.width(), bo unds.height()), 42 canvas->drawRect(SkRect::MakeXYWH(bounds.x(), bounds.y(), bounds.width(), bo unds.height()),
43 SkPaint()); 43 SkPaint());
44 return fromSkSp(recorder.finishRecordingAsPicture()); 44 return fromSkSp(recorder.finishRecordingAsPicture());
45 } 45 }
46 46
47 TEST_F(DisplayItemListTest, AppendVisualRect_Simple) 47 TEST_F(DisplayItemListTest, AppendVisualRect_Simple)
48 { 48 {
49 IntRect drawingBounds(5, 6, 7, 8); 49 IntRect drawingBounds(5, 6, 7, 8);
50 m_list.allocateAndConstruct<DrawingDisplayItem>( 50 m_list.allocateAndConstruct<DrawingDisplayItem>(
51 m_client, DisplayItem::Type::DocumentBackground, createRectPicture(drawi ngBounds), true); 51 m_client, DisplayItem::Type::kDocumentBackground, createRectPicture(draw ingBounds), true);
52 m_list.appendVisualRect(drawingBounds); 52 m_list.appendVisualRect(drawingBounds);
53 53
54 EXPECT_EQ(static_cast<size_t>(1), m_list.size()); 54 EXPECT_EQ(static_cast<size_t>(1), m_list.size());
55 EXPECT_RECT_EQ(drawingBounds, m_list.visualRect(0)); 55 EXPECT_RECT_EQ(drawingBounds, m_list.visualRect(0));
56 } 56 }
57 57
58 TEST_F(DisplayItemListTest, AppendVisualRect_BlockContainingDrawing) 58 TEST_F(DisplayItemListTest, AppendVisualRect_BlockContainingDrawing)
59 { 59 {
60 // 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
61 // irrelevant as they're overwritten in cc::DisplayItemList when rebuilt to 61 // irrelevant as they're overwritten in cc::DisplayItemList when rebuilt to
62 // 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
63 // 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
64 // so as to only store visual rects for drawing display items. 64 // so as to only store visual rects for drawing display items.
65 65
66 IntRect subsequenceBounds(5, 6, 7, 8); 66 IntRect subsequenceBounds(5, 6, 7, 8);
67 m_list.allocateAndConstruct<BeginSubsequenceDisplayItem>(m_client); 67 m_list.allocateAndConstruct<BeginSubsequenceDisplayItem>(m_client);
68 m_list.appendVisualRect(subsequenceBounds); 68 m_list.appendVisualRect(subsequenceBounds);
69 69
70 IntRect drawingBounds(5, 6, 1, 1); 70 IntRect drawingBounds(5, 6, 1, 1);
71 m_list.allocateAndConstruct<DrawingDisplayItem>( 71 m_list.allocateAndConstruct<DrawingDisplayItem>(
72 m_client, DisplayItem::Type::DocumentBackground, createRectPicture(drawi ngBounds), true); 72 m_client, DisplayItem::Type::kDocumentBackground, createRectPicture(draw ingBounds), true);
73 m_list.appendVisualRect(drawingBounds); 73 m_list.appendVisualRect(drawingBounds);
74 74
75 m_list.allocateAndConstruct<EndSubsequenceDisplayItem>(m_client); 75 m_list.allocateAndConstruct<EndSubsequenceDisplayItem>(m_client);
76 m_list.appendVisualRect(subsequenceBounds); 76 m_list.appendVisualRect(subsequenceBounds);
77 77
78 EXPECT_EQ(static_cast<size_t>(3), m_list.size()); 78 EXPECT_EQ(static_cast<size_t>(3), m_list.size());
79 EXPECT_RECT_EQ(subsequenceBounds, m_list.visualRect(0)); 79 EXPECT_RECT_EQ(subsequenceBounds, m_list.visualRect(0));
80 EXPECT_RECT_EQ(drawingBounds, m_list.visualRect(1)); 80 EXPECT_RECT_EQ(drawingBounds, m_list.visualRect(1));
81 EXPECT_RECT_EQ(subsequenceBounds, m_list.visualRect(2)); 81 EXPECT_RECT_EQ(subsequenceBounds, m_list.visualRect(2));
82 } 82 }
83 } // namespace 83 } // namespace
84 } // namespace blink 84 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698