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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "core/paint/LayerClipRecorder.h" | 7 #include "core/paint/LayerClipRecorder.h" |
8 #include "core/paint/RenderDrawingRecorder.h" | 8 #include "core/paint/RenderDrawingRecorder.h" |
9 #include "core/rendering/RenderView.h" | 9 #include "core/rendering/RenderView.h" |
10 #include "core/rendering/RenderingTestHelper.h" | 10 #include "core/rendering/RenderingTestHelper.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 EXPECT_EQ((size_t)expectedSize, actual.size()); \ | 52 EXPECT_EQ((size_t)expectedSize, actual.size()); \ |
53 const TestDisplayItem expected[] = { __VA_ARGS__ }; \ | 53 const TestDisplayItem expected[] = { __VA_ARGS__ }; \ |
54 for (size_t index = 0; index < expectedSize; index++) { \ | 54 for (size_t index = 0; index < expectedSize; index++) { \ |
55 EXPECT_EQ(expected[index].client(), actual[index]->client()); \ | 55 EXPECT_EQ(expected[index].client(), actual[index]->client()); \ |
56 EXPECT_EQ(expected[index].type(), actual[index]->type()); \ | 56 EXPECT_EQ(expected[index].type(), actual[index]->type()); \ |
57 } \ | 57 } \ |
58 } | 58 } |
59 | 59 |
60 void drawRect(GraphicsContext* context, RenderObject* renderer, PaintPhase phase
, const FloatRect& bound) | 60 void drawRect(GraphicsContext* context, RenderObject* renderer, PaintPhase phase
, const FloatRect& bound) |
61 { | 61 { |
62 RenderDrawingRecorder drawingRecorder(context, renderer, phase, bound); | 62 RenderDrawingRecorder drawingRecorder(context, *renderer, phase, bound); |
| 63 if (drawingRecorder.canUseCachedDrawing()) |
| 64 return; |
63 IntRect rect(0, 0, 10, 10); | 65 IntRect rect(0, 0, 10, 10); |
64 context->drawRect(rect); | 66 context->drawRect(rect); |
65 } | 67 } |
66 | 68 |
67 void drawClippedRect(GraphicsContext* context, RenderLayerModelObject* renderer,
PaintPhase phase, const FloatRect& bound) | 69 void drawClippedRect(GraphicsContext* context, RenderLayerModelObject* renderer,
PaintPhase phase, const FloatRect& bound) |
68 { | 70 { |
69 IntRect rect(1, 1, 9, 9); | 71 IntRect rect(1, 1, 9, 9); |
70 ClipRect clipRect(rect); | 72 ClipRect clipRect(rect); |
71 LayerClipRecorder layerClipRecorder(renderer, context, DisplayItem::ClipLaye
rForeground, clipRect, 0, LayoutPoint(), PaintLayerFlags()); | 73 LayerClipRecorder layerClipRecorder(renderer, context, DisplayItem::ClipLaye
rForeground, clipRect, 0, LayoutPoint(), PaintLayerFlags()); |
72 drawRect(context, renderer, phase, bound); | 74 drawRect(context, renderer, phase, bound); |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(firstRenderer->displayI
temClient())); | 437 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(firstRenderer->displayI
temClient())); |
436 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(secondRenderer->display
ItemClient())); | 438 EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(secondRenderer->display
ItemClient())); |
437 | 439 |
438 rootDisplayItemList().invalidateAll(); | 440 rootDisplayItemList().invalidateAll(); |
439 EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(firstRenderer->display
ItemClient())); | 441 EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(firstRenderer->display
ItemClient())); |
440 EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(secondRenderer->displa
yItemClient())); | 442 EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(secondRenderer->displa
yItemClient())); |
441 } | 443 } |
442 | 444 |
443 } // anonymous namespace | 445 } // anonymous namespace |
444 } // namespace blink | 446 } // namespace blink |
OLD | NEW |