| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 #ifndef NDEBUG | 67 #ifndef NDEBUG |
| 68 bool fillWithRed; | 68 bool fillWithRed; |
| 69 if (document->printing()) | 69 if (document->printing()) |
| 70 fillWithRed = false; // Printing, don't fill with red (can't remember wh
y). | 70 fillWithRed = false; // Printing, don't fill with red (can't remember wh
y). |
| 71 else if (frameView().frame().owner()) | 71 else if (frameView().frame().owner()) |
| 72 fillWithRed = false; // Subframe, don't fill with red. | 72 fillWithRed = false; // Subframe, don't fill with red. |
| 73 else if (frameView().isTransparent()) | 73 else if (frameView().isTransparent()) |
| 74 fillWithRed = false; // Transparent, don't fill with red. | 74 fillWithRed = false; // Transparent, don't fill with red. |
| 75 else if (globalPaintFlags & GlobalPaintSelectionOnly) | 75 else if (globalPaintFlags & GlobalPaintSelectionOnly) |
| 76 fillWithRed = false; // Selections are transparent, don't fill with red. | 76 fillWithRed = false; // Selections are transparent, don't fill with red. |
| 77 else if (frameView().nodeToDraw()) | |
| 78 fillWithRed = false; // Element images are transparent, don't fill with
red. | |
| 79 else | 77 else |
| 80 fillWithRed = true; | 78 fillWithRed = true; |
| 81 | 79 |
| 82 if (fillWithRed && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(
context, *frameView().layoutView(), DisplayItem::DebugRedFill, LayoutPoint())) { | 80 if (fillWithRed && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(
context, *frameView().layoutView(), DisplayItem::DebugRedFill, LayoutPoint())) { |
| 83 IntRect contentRect(IntPoint(), frameView().contentsSize()); | 81 IntRect contentRect(IntPoint(), frameView().contentsSize()); |
| 84 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().layout
View(), DisplayItem::DebugRedFill, contentRect, LayoutPoint()); | 82 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().layout
View(), DisplayItem::DebugRedFill, contentRect, LayoutPoint()); |
| 85 } | 83 } |
| 86 #endif | 84 #endif |
| 87 | 85 |
| 88 LayoutView* layoutView = frameView().layoutView(); | 86 LayoutView* layoutView = frameView().layoutView(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 103 | 101 |
| 104 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint | 102 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint |
| 105 // phase. Thus we should set this flag upfront (crbug.com/510280). | 103 // phase. Thus we should set this flag upfront (crbug.com/510280). |
| 106 GlobalPaintFlags localPaintFlags = globalPaintFlags; | 104 GlobalPaintFlags localPaintFlags = globalPaintFlags; |
| 107 if (document->printing()) | 105 if (document->printing()) |
| 108 localPaintFlags |= GlobalPaintFlattenCompositingLayers | GlobalPaintPrin
ting; | 106 localPaintFlags |= GlobalPaintFlattenCompositingLayers | GlobalPaintPrin
ting; |
| 109 | 107 |
| 110 ASSERT(!frameView().isPainting()); | 108 ASSERT(!frameView().isPainting()); |
| 111 frameView().setIsPainting(true); | 109 frameView().setIsPainting(true); |
| 112 | 110 |
| 113 // frameView().nodeToDraw() is used to draw only one element (and its descen
dants) | |
| 114 LayoutObject* layoutObject = frameView().nodeToDraw() ? frameView().nodeToDr
aw()->layoutObject() : 0; | |
| 115 PaintLayer* rootLayer = layoutView->layer(); | 111 PaintLayer* rootLayer = layoutView->layer(); |
| 116 | 112 |
| 117 #if ENABLE(ASSERT) | 113 #if ENABLE(ASSERT) |
| 118 layoutView->assertSubtreeIsLaidOut(); | 114 layoutView->assertSubtreeIsLaidOut(); |
| 119 LayoutObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer-
>layoutObject()); | 115 LayoutObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer-
>layoutObject()); |
| 120 #endif | 116 #endif |
| 121 | 117 |
| 122 PaintLayerPainter layerPainter(*rootLayer); | 118 PaintLayerPainter layerPainter(*rootLayer); |
| 123 | 119 |
| 124 float deviceScaleFactor = blink::deviceScaleFactor(rootLayer->layoutObject()
->frame()); | 120 float deviceScaleFactor = blink::deviceScaleFactor(rootLayer->layoutObject()
->frame()); |
| 125 context.setDeviceScaleFactor(deviceScaleFactor); | 121 context.setDeviceScaleFactor(deviceScaleFactor); |
| 126 | 122 |
| 127 layerPainter.paint(context, LayoutRect(rect), localPaintFlags, layoutObject)
; | 123 layerPainter.paint(context, LayoutRect(rect), localPaintFlags); |
| 128 | 124 |
| 129 if (rootLayer->containsDirtyOverlayScrollbars()) | 125 if (rootLayer->containsDirtyOverlayScrollbars()) |
| 130 layerPainter.paintOverlayScrollbars(context, LayoutRect(rect), localPain
tFlags, layoutObject); | 126 layerPainter.paintOverlayScrollbars(context, LayoutRect(rect), localPain
tFlags); |
| 131 | 127 |
| 132 frameView().setIsPainting(false); | 128 frameView().setIsPainting(false); |
| 133 | 129 |
| 134 // Regions may have changed as a result of the visibility/z-index of element
changing. | 130 // Regions may have changed as a result of the visibility/z-index of element
changing. |
| 135 if (document->annotatedRegionsDirty()) | 131 if (document->annotatedRegionsDirty()) |
| 136 frameView().updateDocumentAnnotatedRegions(); | 132 frameView().updateDocumentAnnotatedRegions(); |
| 137 | 133 |
| 138 if (isTopLevelPainter) { | 134 if (isTopLevelPainter) { |
| 139 // Everything that happens after paintContents completions is considered | 135 // Everything that happens after paintContents completions is considered |
| 140 // to be part of the next frame. | 136 // to be part of the next frame. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 bar.paint(context, CullRect(rect)); | 182 bar.paint(context, CullRect(rect)); |
| 187 } | 183 } |
| 188 | 184 |
| 189 const FrameView& FramePainter::frameView() | 185 const FrameView& FramePainter::frameView() |
| 190 { | 186 { |
| 191 ASSERT(m_frameView); | 187 ASSERT(m_frameView); |
| 192 return *m_frameView; | 188 return *m_frameView; |
| 193 } | 189 } |
| 194 | 190 |
| 195 } // namespace blink | 191 } // namespace blink |
| OLD | NEW |