| 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 "core/paint/FramePainter.h" | 5 #include "core/paint/FramePainter.h" |
| 6 | 6 |
| 7 #include "core/editing/markers/DocumentMarkerController.h" | 7 #include "core/editing/markers/DocumentMarkerController.h" |
| 8 #include "core/fetch/MemoryCache.h" | 8 #include "core/fetch/MemoryCache.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/inspector/InspectorInstrumentation.h" | 10 #include "core/inspector/InspectorInstrumentation.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 fillWithRed = false; // Printing, don't fill with red (can't remember wh
y). | 101 fillWithRed = false; // Printing, don't fill with red (can't remember wh
y). |
| 102 else if (frameView().frame().owner()) | 102 else if (frameView().frame().owner()) |
| 103 fillWithRed = false; // Subframe, don't fill with red. | 103 fillWithRed = false; // Subframe, don't fill with red. |
| 104 else if (frameView().isTransparent()) | 104 else if (frameView().isTransparent()) |
| 105 fillWithRed = false; // Transparent, don't fill with red. | 105 fillWithRed = false; // Transparent, don't fill with red. |
| 106 else if (globalPaintFlags & GlobalPaintSelectionOnly) | 106 else if (globalPaintFlags & GlobalPaintSelectionOnly) |
| 107 fillWithRed = false; // Selections are transparent, don't fill with red. | 107 fillWithRed = false; // Selections are transparent, don't fill with red. |
| 108 else | 108 else |
| 109 fillWithRed = true; | 109 fillWithRed = true; |
| 110 | 110 |
| 111 if (fillWithRed && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(
context, *frameView().layoutView(), DisplayItem::DebugRedFill, LayoutPoint())) { | 111 if (fillWithRed && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(
context, *frameView().layoutView(), DisplayItem::DebugRedFill)) { |
| 112 IntRect contentRect(IntPoint(), frameView().contentsSize()); | 112 IntRect contentRect(IntPoint(), frameView().contentsSize()); |
| 113 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().layout
View(), DisplayItem::DebugRedFill, contentRect, LayoutPoint()); | 113 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().layout
View(), DisplayItem::DebugRedFill, contentRect); |
| 114 } | 114 } |
| 115 #endif | 115 #endif |
| 116 | 116 |
| 117 LayoutView* layoutView = frameView().layoutView(); | 117 LayoutView* layoutView = frameView().layoutView(); |
| 118 if (!layoutView) { | 118 if (!layoutView) { |
| 119 WTF_LOG_ERROR("called FramePainter::paint with nil layoutObject"); | 119 WTF_LOG_ERROR("called FramePainter::paint with nil layoutObject"); |
| 120 return; | 120 return; |
| 121 } | 121 } |
| 122 | 122 |
| 123 if (!frameView().shouldThrottleRendering()) { | 123 if (!frameView().shouldThrottleRendering()) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 if (frameView().layerForScrollCorner()) | 185 if (frameView().layerForScrollCorner()) |
| 186 return; | 186 return; |
| 187 | 187 |
| 188 paintScrollCorner(context, frameView().scrollCornerRect()); | 188 paintScrollCorner(context, frameView().scrollCornerRect()); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void FramePainter::paintScrollCorner(GraphicsContext& context, const IntRect& co
rnerRect) | 191 void FramePainter::paintScrollCorner(GraphicsContext& context, const IntRect& co
rnerRect) |
| 192 { | 192 { |
| 193 if (frameView().scrollCorner()) { | 193 if (frameView().scrollCorner()) { |
| 194 bool needsBackground = frameView().frame().isMainFrame(); | 194 bool needsBackground = frameView().frame().isMainFrame(); |
| 195 if (needsBackground && !LayoutObjectDrawingRecorder::useCachedDrawingIfP
ossible(context, *frameView().layoutView(), DisplayItem::ScrollbarCorner, Layout
Point())) { | 195 if (needsBackground && !LayoutObjectDrawingRecorder::useCachedDrawingIfP
ossible(context, *frameView().layoutView(), DisplayItem::ScrollbarCorner)) { |
| 196 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().la
youtView(), DisplayItem::ScrollbarCorner, FloatRect(cornerRect), LayoutPoint()); | 196 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().la
youtView(), DisplayItem::ScrollbarCorner, FloatRect(cornerRect)); |
| 197 context.fillRect(cornerRect, frameView().baseBackgroundColor()); | 197 context.fillRect(cornerRect, frameView().baseBackgroundColor()); |
| 198 | 198 |
| 199 } | 199 } |
| 200 ScrollbarPainter::paintIntoRect(*frameView().scrollCorner(), context, co
rnerRect.location(), LayoutRect(cornerRect)); | 200 ScrollbarPainter::paintIntoRect(*frameView().scrollCorner(), context, co
rnerRect.location(), LayoutRect(cornerRect)); |
| 201 return; | 201 return; |
| 202 } | 202 } |
| 203 | 203 |
| 204 ScrollbarTheme::theme().paintScrollCorner(context, *frameView().layoutView()
, cornerRect); | 204 ScrollbarTheme::theme().paintScrollCorner(context, *frameView().layoutView()
, cornerRect); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void FramePainter::paintScrollbar(GraphicsContext& context, Scrollbar& bar, cons
t IntRect& rect) | 207 void FramePainter::paintScrollbar(GraphicsContext& context, Scrollbar& bar, cons
t IntRect& rect) |
| 208 { | 208 { |
| 209 bool needsBackground = bar.isCustomScrollbar() && frameView().frame().isMain
Frame(); | 209 bool needsBackground = bar.isCustomScrollbar() && frameView().frame().isMain
Frame(); |
| 210 if (needsBackground) { | 210 if (needsBackground) { |
| 211 IntRect toFill = bar.frameRect(); | 211 IntRect toFill = bar.frameRect(); |
| 212 toFill.intersect(rect); | 212 toFill.intersect(rect); |
| 213 context.fillRect(toFill, frameView().baseBackgroundColor()); | 213 context.fillRect(toFill, frameView().baseBackgroundColor()); |
| 214 } | 214 } |
| 215 | 215 |
| 216 bar.paint(context, CullRect(rect)); | 216 bar.paint(context, CullRect(rect)); |
| 217 } | 217 } |
| 218 | 218 |
| 219 const FrameView& FramePainter::frameView() | 219 const FrameView& FramePainter::frameView() |
| 220 { | 220 { |
| 221 ASSERT(m_frameView); | 221 ASSERT(m_frameView); |
| 222 return *m_frameView; | 222 return *m_frameView; |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace blink | 225 } // namespace blink |
| OLD | NEW |