OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 context.setAnnotationMode(AnnotateAll); | 65 context.setAnnotationMode(AnnotateAll); |
66 | 66 |
67 m_painter->paint(context, clip); | 67 m_painter->paint(context, clip); |
68 | 68 |
69 if (DisplayItemList* displayItemList = m_painter->displayItemList()) | 69 if (DisplayItemList* displayItemList = m_painter->displayItemList()) |
70 displayItemList->endNewPaints(); | 70 displayItemList->endNewPaints(); |
71 } | 71 } |
72 | 72 |
73 void ContentLayerDelegate::paintContents( | 73 void ContentLayerDelegate::paintContents( |
74 WebDisplayItemList* webDisplayItemList, const WebRect& clip, | 74 WebDisplayItemList* webDisplayItemList, const WebRect& clip, |
75 WebContentLayerClient::GraphicsContextStatus contextStatus) | 75 const bool clearCaches, WebContentLayerClient::GraphicsContextStatus context
Status) |
76 { | 76 { |
77 // Once Slimming Paint is fully implemented, this method will no longer | 77 // Once Slimming Paint is fully implemented, this method will no longer |
78 // be needed since Blink will be in charge of creating the display list | 78 // be needed since Blink will be in charge of creating the display list |
79 // during the document lifecylcle. | 79 // during the document lifecylcle. |
80 | 80 |
| 81 if (clearCaches) |
| 82 m_painter->displayItemList()->invalidateAll(); |
| 83 |
81 // Some layers don't yet produce display lists. To handle such layers, we | 84 // Some layers don't yet produce display lists. To handle such layers, we |
82 // create a canvas backed by an SkPicture, and manually insert this | 85 // create a canvas backed by an SkPicture, and manually insert this |
83 // SkPicture into the WebDisplayItemList when the layer's display list is | 86 // SkPicture into the WebDisplayItemList when the layer's display list is |
84 // empty. | 87 // empty. |
85 SkPictureRecorder recorder; | 88 SkPictureRecorder recorder; |
86 RefPtr<SkPicture> picture; | 89 RefPtr<SkPicture> picture; |
87 SkCanvas* canvas = recorder.beginRecording(clip.width, clip.height); | 90 SkCanvas* canvas = recorder.beginRecording(clip.width, clip.height); |
88 canvas->save(); | 91 canvas->save(); |
89 canvas->translate(-clip.x, -clip.y); | 92 canvas->translate(-clip.x, -clip.y); |
90 canvas->clipRect(SkRect::MakeXYWH(clip.x, clip.y, clip.width, clip.height)); | 93 canvas->clipRect(SkRect::MakeXYWH(clip.x, clip.y, clip.width, clip.height)); |
91 paintContents(canvas, clip, contextStatus); | 94 paintContents(canvas, clip, contextStatus); |
92 canvas->restore(); | 95 canvas->restore(); |
93 picture = adoptRef(recorder.endRecording()); | 96 picture = adoptRef(recorder.endRecording()); |
94 | 97 |
95 const PaintList& paintList = m_painter->displayItemList()->paintList(); | 98 const PaintList& paintList = m_painter->displayItemList()->paintList(); |
96 for (PaintList::const_iterator it = paintList.begin(); it != paintList.end()
; ++it) | 99 for (PaintList::const_iterator it = paintList.begin(); it != paintList.end()
; ++it) |
97 (*it)->appendToWebDisplayItemList(webDisplayItemList); | 100 (*it)->appendToWebDisplayItemList(webDisplayItemList); |
98 } | 101 } |
99 | 102 |
100 } // namespace blink | 103 } // namespace blink |
OLD | NEW |