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 #include "core/paint/ViewDisplayList.h" | 6 #include "core/paint/ViewDisplayList.h" |
7 | 7 |
| 8 #include "core/frame/LocalFrame.h" |
| 9 #include "core/rendering/RenderLayer.h" |
| 10 #include "core/rendering/RenderView.h" |
8 #include "platform/NotImplemented.h" | 11 #include "platform/NotImplemented.h" |
9 #include "platform/RuntimeEnabledFeatures.h" | 12 #include "platform/RuntimeEnabledFeatures.h" |
10 | 13 |
11 #ifndef NDEBUG | 14 #ifndef NDEBUG |
12 #include "core/rendering/RenderObject.h" | 15 #include "core/rendering/RenderObject.h" |
13 #include "wtf/text/WTFString.h" | 16 #include "wtf/text/WTFString.h" |
14 #endif | 17 #endif |
15 | 18 |
16 namespace blink { | 19 namespace blink { |
17 | 20 |
(...skipping 30 matching lines...) Expand all Loading... |
48 // Update the existing paintList by removing invalidated entries, updating repai
nted existing ones, and | 51 // Update the existing paintList by removing invalidated entries, updating repai
nted existing ones, and |
49 // appending new items. | 52 // appending new items. |
50 // | 53 // |
51 // The algorithm should be O(|existing paint list| + |newly painted list|). By u
sing the ordering | 54 // The algorithm should be O(|existing paint list| + |newly painted list|). By u
sing the ordering |
52 // implied by the existing paint list, extra treewalks are avoided. | 55 // implied by the existing paint list, extra treewalks are avoided. |
53 void ViewDisplayList::updatePaintList() | 56 void ViewDisplayList::updatePaintList() |
54 { | 57 { |
55 notImplemented(); | 58 notImplemented(); |
56 } | 59 } |
57 | 60 |
| 61 ViewDisplayList& ViewDisplayList::fromRenderObject(const RenderObject* renderer) |
| 62 { |
| 63 ASSERT(renderer); |
| 64 |
| 65 RenderView* renderView = renderer->view(); |
| 66 ASSERT(renderView); |
| 67 |
| 68 FrameView* frameView = renderView->frameView(); |
| 69 ASSERT(frameView); |
| 70 |
| 71 LocalFrame* localRoot = frameView->frame().localRoot(); |
| 72 ASSERT(localRoot); |
| 73 |
| 74 FrameView* localRootView = localRoot->view(); |
| 75 ASSERT(localRootView); |
| 76 |
| 77 return localRootView->viewDisplayList(); |
| 78 } |
| 79 |
| 80 ViewDisplayList& ViewDisplayList::fromRenderLayer(const RenderLayer* layer) |
| 81 { |
| 82 ASSERT(layer); |
| 83 return fromRenderObject(layer->renderer()); |
| 84 } |
| 85 |
58 #ifndef NDEBUG | 86 #ifndef NDEBUG |
59 WTF::String DisplayItem::typeAsDebugString(DisplayItem::Type type) | 87 WTF::String DisplayItem::typeAsDebugString(DisplayItem::Type type) |
60 { | 88 { |
61 switch (type) { | 89 switch (type) { |
62 case DisplayItem::DrawingPaintPhaseBlockBackground: return "DrawingPaintPhas
eBlockBackground"; | 90 case DisplayItem::DrawingPaintPhaseBlockBackground: return "DrawingPaintPhas
eBlockBackground"; |
63 case DisplayItem::DrawingPaintPhaseChildBlockBackground: return "DrawingPain
tPhaseChildBlockBackground"; | 91 case DisplayItem::DrawingPaintPhaseChildBlockBackground: return "DrawingPain
tPhaseChildBlockBackground"; |
64 case DisplayItem::DrawingPaintPhaseChildBlockBackgrounds: return "DrawingPai
ntPhaseChildBlockBackgrounds"; | 92 case DisplayItem::DrawingPaintPhaseChildBlockBackgrounds: return "DrawingPai
ntPhaseChildBlockBackgrounds"; |
65 case DisplayItem::DrawingPaintPhaseFloat: return "DrawingPaintPhaseFloat"; | 93 case DisplayItem::DrawingPaintPhaseFloat: return "DrawingPaintPhaseFloat"; |
66 case DisplayItem::DrawingPaintPhaseForeground: return "DrawingPaintPhaseFore
ground"; | 94 case DisplayItem::DrawingPaintPhaseForeground: return "DrawingPaintPhaseFore
ground"; |
67 case DisplayItem::DrawingPaintPhaseOutline: return "DrawingPaintPhaseOutline
"; | 95 case DisplayItem::DrawingPaintPhaseOutline: return "DrawingPaintPhaseOutline
"; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 146 } |
119 | 147 |
120 void ViewDisplayList::showDebugData() const | 148 void ViewDisplayList::showDebugData() const |
121 { | 149 { |
122 fprintf(stderr, "paint list: [%s]\n", paintListAsDebugString(m_paintList).ut
f8().data()); | 150 fprintf(stderr, "paint list: [%s]\n", paintListAsDebugString(m_paintList).ut
f8().data()); |
123 fprintf(stderr, "new paints: [%s]\n", paintListAsDebugString(m_newPaints).ut
f8().data()); | 151 fprintf(stderr, "new paints: [%s]\n", paintListAsDebugString(m_newPaints).ut
f8().data()); |
124 } | 152 } |
125 #endif | 153 #endif |
126 | 154 |
127 } // namespace blink | 155 } // namespace blink |
OLD | NEW |