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/page/PrintContext.h" | 5 #include "core/page/PrintContext.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
9 #include "core/html/HTMLElement.h" | 9 #include "core/html/HTMLElement.h" |
10 #include "core/layout/LayoutTestHelper.h" | 10 #include "core/layout/LayoutTestHelper.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 MockCanvas() : SkCanvas(kPageWidth, kPageHeight) {} | 48 MockCanvas() : SkCanvas(kPageWidth, kPageHeight) {} |
49 | 49 |
50 void onDrawAnnotation(const SkRect& rect, | 50 void onDrawAnnotation(const SkRect& rect, |
51 const char key[], | 51 const char key[], |
52 SkData* value) override { | 52 SkData* value) override { |
53 if (rect.width() == 0 && rect.height() == 0) { | 53 if (rect.width() == 0 && rect.height() == 0) { |
54 SkPoint point = getTotalMatrix().mapXY(rect.x(), rect.y()); | 54 SkPoint point = getTotalMatrix().mapXY(rect.x(), rect.y()); |
55 Operation operation = {DrawPoint, | 55 Operation operation = {DrawPoint, |
56 SkRect::MakeXYWH(point.x(), point.y(), 0, 0)}; | 56 SkRect::MakeXYWH(point.x(), point.y(), 0, 0)}; |
57 m_recordedOperations.append(operation); | 57 m_recordedOperations.push_back(operation); |
58 } else { | 58 } else { |
59 Operation operation = {DrawRect, rect}; | 59 Operation operation = {DrawRect, rect}; |
60 getTotalMatrix().mapRect(&operation.rect); | 60 getTotalMatrix().mapRect(&operation.rect); |
61 m_recordedOperations.append(operation); | 61 m_recordedOperations.push_back(operation); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 const Vector<Operation>& recordedOperations() const { | 65 const Vector<Operation>& recordedOperations() const { |
66 return m_recordedOperations; | 66 return m_recordedOperations; |
67 } | 67 } |
68 | 68 |
69 private: | 69 private: |
70 Vector<Operation> m_recordedOperations; | 70 Vector<Operation> m_recordedOperations; |
71 }; | 71 }; |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); | 350 EXPECT_EQ(MockCanvas::DrawRect, operations[0].type); |
351 EXPECT_SKRECT_EQ(50, 60, 70, 80, | 351 EXPECT_SKRECT_EQ(50, 60, 70, 80, |
352 operations[0].rect); // FIXME: the rect should be clipped. | 352 operations[0].rect); // FIXME: the rect should be clipped. |
353 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type); | 353 EXPECT_EQ(MockCanvas::DrawRect, operations[1].type); |
354 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); | 354 EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect); |
355 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); | 355 EXPECT_EQ(MockCanvas::DrawRect, operations[2].type); |
356 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); | 356 EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect); |
357 } | 357 } |
358 | 358 |
359 } // namespace blink | 359 } // namespace blink |
OLD | NEW |