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/FramePainter.h" | 6 #include "core/paint/FramePainter.h" |
7 | 7 |
8 #include "core/dom/DocumentMarkerController.h" | 8 #include "core/dom/DocumentMarkerController.h" |
9 #include "core/fetch/MemoryCache.h" | 9 #include "core/fetch/MemoryCache.h" |
10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 fillWithRed = false; // Subframe, don't fill with red. | 73 fillWithRed = false; // Subframe, don't fill with red. |
74 else if (m_frameView.isTransparent()) | 74 else if (m_frameView.isTransparent()) |
75 fillWithRed = false; // Transparent, don't fill with red. | 75 fillWithRed = false; // Transparent, don't fill with red. |
76 else if (m_frameView.paintBehavior() & PaintBehaviorSelectionOnly) | 76 else if (m_frameView.paintBehavior() & PaintBehaviorSelectionOnly) |
77 fillWithRed = false; // Selections are transparent, don't fill with red. | 77 fillWithRed = false; // Selections are transparent, don't fill with red. |
78 else if (m_frameView.nodeToDraw()) | 78 else if (m_frameView.nodeToDraw()) |
79 fillWithRed = false; // Element images are transparent, don't fill with
red. | 79 fillWithRed = false; // Element images are transparent, don't fill with
red. |
80 else | 80 else |
81 fillWithRed = true; | 81 fillWithRed = true; |
82 | 82 |
83 if (fillWithRed) { | 83 if (fillWithRed && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(
*context, *m_frameView.layoutView(), DisplayItem::DebugRedFill)) { |
84 IntRect contentRect(IntPoint(), m_frameView.contentsSize()); | 84 IntRect contentRect(IntPoint(), m_frameView.contentsSize()); |
85 LayoutObjectDrawingRecorder drawingRecorder(*context, *m_frameView.layou
tView(), DisplayItem::DebugRedFill, contentRect); | 85 LayoutObjectDrawingRecorder drawingRecorder(*context, *m_frameView.layou
tView(), DisplayItem::DebugRedFill, contentRect); |
86 if (!drawingRecorder.canUseCachedDrawing()) | |
87 context->fillRect(contentRect, Color(0xFF, 0, 0)); | |
88 } | 86 } |
89 #endif | 87 #endif |
90 | 88 |
91 LayoutView* layoutView = m_frameView.layoutView(); | 89 LayoutView* layoutView = m_frameView.layoutView(); |
92 if (!layoutView) { | 90 if (!layoutView) { |
93 WTF_LOG_ERROR("called FramePainter::paint with nil layoutObject"); | 91 WTF_LOG_ERROR("called FramePainter::paint with nil layoutObject"); |
94 return; | 92 return; |
95 } | 93 } |
96 | 94 |
97 RELEASE_ASSERT(!m_frameView.needsLayout()); | 95 RELEASE_ASSERT(!m_frameView.needsLayout()); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 if (m_frameView.layerForScrollCorner()) | 163 if (m_frameView.layerForScrollCorner()) |
166 return; | 164 return; |
167 | 165 |
168 paintScrollCorner(context, m_frameView.scrollCornerRect()); | 166 paintScrollCorner(context, m_frameView.scrollCornerRect()); |
169 } | 167 } |
170 | 168 |
171 void FramePainter::paintScrollCorner(GraphicsContext* context, const IntRect& co
rnerRect) | 169 void FramePainter::paintScrollCorner(GraphicsContext* context, const IntRect& co
rnerRect) |
172 { | 170 { |
173 if (m_frameView.scrollCorner()) { | 171 if (m_frameView.scrollCorner()) { |
174 bool needsBackground = m_frameView.frame().isMainFrame(); | 172 bool needsBackground = m_frameView.frame().isMainFrame(); |
175 if (needsBackground) { | 173 if (needsBackground && !LayoutObjectDrawingRecorder::useCachedDrawingIfP
ossible(*context, *m_frameView.layoutView(), DisplayItem::ScrollbarCorner)) { |
176 LayoutObjectDrawingRecorder drawingRecorder(*context, *m_frameView.l
ayoutView(), DisplayItem::ScrollbarCorner, cornerRect); | 174 LayoutObjectDrawingRecorder drawingRecorder(*context, *m_frameView.l
ayoutView(), DisplayItem::ScrollbarCorner, cornerRect); |
177 if (!drawingRecorder.canUseCachedDrawing()) | 175 context->fillRect(cornerRect, m_frameView.baseBackgroundColor()); |
178 context->fillRect(cornerRect, m_frameView.baseBackgroundColor())
; | 176 |
179 } | 177 } |
180 ScrollbarPainter::paintIntoRect(m_frameView.scrollCorner(), context, cor
nerRect.location(), LayoutRect(cornerRect)); | 178 ScrollbarPainter::paintIntoRect(m_frameView.scrollCorner(), context, cor
nerRect.location(), LayoutRect(cornerRect)); |
181 return; | 179 return; |
182 } | 180 } |
183 | 181 |
184 ScrollbarTheme::theme()->paintScrollCorner(context, *m_frameView.layoutView(
), cornerRect); | 182 ScrollbarTheme::theme()->paintScrollCorner(context, *m_frameView.layoutView(
), cornerRect); |
185 } | 183 } |
186 | 184 |
187 void FramePainter::paintScrollbar(GraphicsContext* context, Scrollbar* bar, cons
t IntRect& rect) | 185 void FramePainter::paintScrollbar(GraphicsContext* context, Scrollbar* bar, cons
t IntRect& rect) |
188 { | 186 { |
189 bool needsBackground = bar->isCustomScrollbar() && m_frameView.frame().isMai
nFrame(); | 187 bool needsBackground = bar->isCustomScrollbar() && m_frameView.frame().isMai
nFrame(); |
190 if (needsBackground) { | 188 if (needsBackground) { |
191 IntRect toFill = bar->frameRect(); | 189 IntRect toFill = bar->frameRect(); |
192 toFill.intersect(rect); | 190 toFill.intersect(rect); |
193 context->fillRect(toFill, m_frameView.baseBackgroundColor()); | 191 context->fillRect(toFill, m_frameView.baseBackgroundColor()); |
194 } | 192 } |
195 | 193 |
196 bar->paint(context, rect); | 194 bar->paint(context, rect); |
197 } | 195 } |
198 | 196 |
199 } // namespace blink | 197 } // namespace blink |
OLD | NEW |