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