Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: third_party/WebKit/Source/core/paint/FramePainter.cpp

Issue 1610063002: Revert of Remove PaintInfo's paintingRoot (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.
77 else 79 else
78 fillWithRed = true; 80 fillWithRed = true;
79 81
80 if (fillWithRed && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( context, *frameView().layoutView(), DisplayItem::DebugRedFill, LayoutPoint())) { 82 if (fillWithRed && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( context, *frameView().layoutView(), DisplayItem::DebugRedFill, LayoutPoint())) {
81 IntRect contentRect(IntPoint(), frameView().contentsSize()); 83 IntRect contentRect(IntPoint(), frameView().contentsSize());
82 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().layout View(), DisplayItem::DebugRedFill, contentRect, LayoutPoint()); 84 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().layout View(), DisplayItem::DebugRedFill, contentRect, LayoutPoint());
83 } 85 }
84 #endif 86 #endif
85 87
86 LayoutView* layoutView = frameView().layoutView(); 88 LayoutView* layoutView = frameView().layoutView();
(...skipping 14 matching lines...) Expand all
101 103
102 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint 104 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint
103 // phase. Thus we should set this flag upfront (crbug.com/510280). 105 // phase. Thus we should set this flag upfront (crbug.com/510280).
104 GlobalPaintFlags localPaintFlags = globalPaintFlags; 106 GlobalPaintFlags localPaintFlags = globalPaintFlags;
105 if (document->printing()) 107 if (document->printing())
106 localPaintFlags |= GlobalPaintFlattenCompositingLayers | GlobalPaintPrin ting; 108 localPaintFlags |= GlobalPaintFlattenCompositingLayers | GlobalPaintPrin ting;
107 109
108 ASSERT(!frameView().isPainting()); 110 ASSERT(!frameView().isPainting());
109 frameView().setIsPainting(true); 111 frameView().setIsPainting(true);
110 112
113 // frameView().nodeToDraw() is used to draw only one element (and its descen dants)
114 LayoutObject* layoutObject = frameView().nodeToDraw() ? frameView().nodeToDr aw()->layoutObject() : 0;
111 PaintLayer* rootLayer = layoutView->layer(); 115 PaintLayer* rootLayer = layoutView->layer();
112 116
113 #if ENABLE(ASSERT) 117 #if ENABLE(ASSERT)
114 layoutView->assertSubtreeIsLaidOut(); 118 layoutView->assertSubtreeIsLaidOut();
115 LayoutObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer- >layoutObject()); 119 LayoutObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer- >layoutObject());
116 #endif 120 #endif
117 121
118 PaintLayerPainter layerPainter(*rootLayer); 122 PaintLayerPainter layerPainter(*rootLayer);
119 123
120 float deviceScaleFactor = blink::deviceScaleFactor(rootLayer->layoutObject() ->frame()); 124 float deviceScaleFactor = blink::deviceScaleFactor(rootLayer->layoutObject() ->frame());
121 context.setDeviceScaleFactor(deviceScaleFactor); 125 context.setDeviceScaleFactor(deviceScaleFactor);
122 126
123 layerPainter.paint(context, LayoutRect(rect), localPaintFlags); 127 layerPainter.paint(context, LayoutRect(rect), localPaintFlags, layoutObject) ;
124 128
125 if (rootLayer->containsDirtyOverlayScrollbars()) 129 if (rootLayer->containsDirtyOverlayScrollbars())
126 layerPainter.paintOverlayScrollbars(context, LayoutRect(rect), localPain tFlags); 130 layerPainter.paintOverlayScrollbars(context, LayoutRect(rect), localPain tFlags, layoutObject);
127 131
128 frameView().setIsPainting(false); 132 frameView().setIsPainting(false);
129 133
130 // Regions may have changed as a result of the visibility/z-index of element changing. 134 // Regions may have changed as a result of the visibility/z-index of element changing.
131 if (document->annotatedRegionsDirty()) 135 if (document->annotatedRegionsDirty())
132 frameView().updateDocumentAnnotatedRegions(); 136 frameView().updateDocumentAnnotatedRegions();
133 137
134 if (isTopLevelPainter) { 138 if (isTopLevelPainter) {
135 // Everything that happens after paintContents completions is considered 139 // Everything that happens after paintContents completions is considered
136 // to be part of the next frame. 140 // to be part of the next frame.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 bar.paint(context, CullRect(rect)); 186 bar.paint(context, CullRect(rect));
183 } 187 }
184 188
185 const FrameView& FramePainter::frameView() 189 const FrameView& FramePainter::frameView()
186 { 190 {
187 ASSERT(m_frameView); 191 ASSERT(m_frameView);
188 return *m_frameView; 192 return *m_frameView;
189 } 193 }
190 194
191 } // namespace blink 195 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698