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

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

Issue 1370143007: Oilpan: fix build after r351868. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 "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 11 matching lines...) Expand all
22 #include "platform/graphics/GraphicsContext.h" 22 #include "platform/graphics/GraphicsContext.h"
23 #include "platform/graphics/paint/ClipRecorder.h" 23 #include "platform/graphics/paint/ClipRecorder.h"
24 #include "platform/scroll/ScrollbarTheme.h" 24 #include "platform/scroll/ScrollbarTheme.h"
25 25
26 namespace blink { 26 namespace blink {
27 27
28 bool FramePainter::s_inPaintContents = false; 28 bool FramePainter::s_inPaintContents = false;
29 29
30 void FramePainter::paint(GraphicsContext* context, const GlobalPaintFlags global PaintFlags, const IntRect& rect) 30 void FramePainter::paint(GraphicsContext* context, const GlobalPaintFlags global PaintFlags, const IntRect& rect)
31 { 31 {
32 m_frameView.notifyPageThatContentAreaWillPaint(); 32 frameView().notifyPageThatContentAreaWillPaint();
33 33
34 IntRect documentDirtyRect = rect; 34 IntRect documentDirtyRect = rect;
35 IntRect visibleAreaWithoutScrollbars(m_frameView.location(), m_frameView.vis ibleContentRect().size()); 35 IntRect visibleAreaWithoutScrollbars(frameView().location(), frameView().vis ibleContentRect().size());
36 documentDirtyRect.intersect(visibleAreaWithoutScrollbars); 36 documentDirtyRect.intersect(visibleAreaWithoutScrollbars);
37 37
38 if (!documentDirtyRect.isEmpty()) { 38 if (!documentDirtyRect.isEmpty()) {
39 TransformRecorder transformRecorder(*context, *m_frameView.layoutView(), 39 TransformRecorder transformRecorder(*context, *frameView().layoutView(),
40 AffineTransform::translation(m_frameView.x() - m_frameView.scrollX() , m_frameView.y() - m_frameView.scrollY())); 40 AffineTransform::translation(frameView().x() - frameView().scrollX() , frameView().y() - frameView().scrollY()));
41 41
42 ClipRecorder recorder(*context, *m_frameView.layoutView(), DisplayItem:: ClipFrameToVisibleContentRect, LayoutRect(m_frameView.visibleContentRect())); 42 ClipRecorder recorder(*context, *frameView().layoutView(), DisplayItem:: ClipFrameToVisibleContentRect, LayoutRect(frameView().visibleContentRect()));
43 43
44 documentDirtyRect.moveBy(-m_frameView.location() + m_frameView.scrollPos ition()); 44 documentDirtyRect.moveBy(-frameView().location() + frameView().scrollPos ition());
45 paintContents(context, globalPaintFlags, documentDirtyRect); 45 paintContents(context, globalPaintFlags, documentDirtyRect);
46 } 46 }
47 47
48 // Now paint the scrollbars. 48 // Now paint the scrollbars.
49 if (!m_frameView.scrollbarsSuppressed() && (m_frameView.horizontalScrollbar( ) || m_frameView.verticalScrollbar())) { 49 if (!frameView().scrollbarsSuppressed() && (frameView().horizontalScrollbar( ) || frameView().verticalScrollbar())) {
50 IntRect scrollViewDirtyRect = rect; 50 IntRect scrollViewDirtyRect = rect;
51 IntRect visibleAreaWithScrollbars(m_frameView.location(), m_frameView.vi sibleContentRect(IncludeScrollbars).size()); 51 IntRect visibleAreaWithScrollbars(frameView().location(), frameView().vi sibleContentRect(IncludeScrollbars).size());
52 scrollViewDirtyRect.intersect(visibleAreaWithScrollbars); 52 scrollViewDirtyRect.intersect(visibleAreaWithScrollbars);
53 scrollViewDirtyRect.moveBy(-m_frameView.location()); 53 scrollViewDirtyRect.moveBy(-frameView().location());
54 54
55 TransformRecorder transformRecorder(*context, *m_frameView.layoutView(), 55 TransformRecorder transformRecorder(*context, *frameView().layoutView(),
56 AffineTransform::translation(m_frameView.x(), m_frameView.y())); 56 AffineTransform::translation(frameView().x(), frameView().y()));
57 57
58 ClipRecorder recorder(*context, *m_frameView.layoutView(), DisplayItem:: ClipFrameScrollbars, LayoutRect(IntPoint(), visibleAreaWithScrollbars.size())); 58 ClipRecorder recorder(*context, *frameView().layoutView(), DisplayItem:: ClipFrameScrollbars, LayoutRect(IntPoint(), visibleAreaWithScrollbars.size()));
59 59
60 paintScrollbars(context, scrollViewDirtyRect); 60 paintScrollbars(context, scrollViewDirtyRect);
61 } 61 }
62 } 62 }
63 63
64 void FramePainter::paintContents(GraphicsContext* context, const GlobalPaintFlag s globalPaintFlags, const IntRect& rect) 64 void FramePainter::paintContents(GraphicsContext* context, const GlobalPaintFlag s globalPaintFlags, const IntRect& rect)
65 { 65 {
66 Document* document = m_frameView.frame().document(); 66 Document* document = frameView().frame().document();
67 67
68 #ifndef NDEBUG 68 #ifndef NDEBUG
69 bool fillWithRed; 69 bool fillWithRed;
70 if (document->printing()) 70 if (document->printing())
71 fillWithRed = false; // Printing, don't fill with red (can't remember wh y). 71 fillWithRed = false; // Printing, don't fill with red (can't remember wh y).
72 else if (m_frameView.frame().owner()) 72 else if (frameView().frame().owner())
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 (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 (m_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, *m_frameView.layoutView(), DisplayItem::DebugRedFill, LayoutPoint())) { 83 if (fillWithRed && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( *context, *frameView().layoutView(), DisplayItem::DebugRedFill, LayoutPoint())) {
84 IntRect contentRect(IntPoint(), m_frameView.contentsSize()); 84 IntRect contentRect(IntPoint(), frameView().contentsSize());
85 LayoutObjectDrawingRecorder drawingRecorder(*context, *m_frameView.layou tView(), DisplayItem::DebugRedFill, contentRect, LayoutPoint()); 85 LayoutObjectDrawingRecorder drawingRecorder(*context, *frameView().layou tView(), DisplayItem::DebugRedFill, contentRect, LayoutPoint());
86 } 86 }
87 #endif 87 #endif
88 88
89 LayoutView* layoutView = m_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(!m_frameView.needsLayout()); 95 RELEASE_ASSERT(!frameView().needsLayout());
96 ASSERT(document->lifecycle().state() >= DocumentLifecycle::CompositingClean) ; 96 ASSERT(document->lifecycle().state() >= DocumentLifecycle::CompositingClean) ;
97 97
98 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data (layoutView, LayoutRect(rect), 0)); 98 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data (layoutView, LayoutRect(rect), 0));
99 99
100 bool isTopLevelPainter = !s_inPaintContents; 100 bool isTopLevelPainter = !s_inPaintContents;
101 s_inPaintContents = true; 101 s_inPaintContents = true;
102 102
103 FontCachePurgePreventer fontCachePurgePreventer; 103 FontCachePurgePreventer fontCachePurgePreventer;
104 104
105 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint 105 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint
106 // phase. Thus we should set this flag upfront (crbug.com/510280). 106 // phase. Thus we should set this flag upfront (crbug.com/510280).
107 GlobalPaintFlags localPaintFlags = globalPaintFlags; 107 GlobalPaintFlags localPaintFlags = globalPaintFlags;
108 if (document->printing()) 108 if (document->printing())
109 localPaintFlags |= GlobalPaintFlattenCompositingLayers | GlobalPaintPrin ting; 109 localPaintFlags |= GlobalPaintFlattenCompositingLayers | GlobalPaintPrin ting;
110 110
111 ASSERT(!m_frameView.isPainting()); 111 ASSERT(!frameView().isPainting());
112 m_frameView.setIsPainting(true); 112 frameView().setIsPainting(true);
113 113
114 // m_frameView.nodeToDraw() is used to draw only one element (and its descen dants) 114 // frameView().nodeToDraw() is used to draw only one element (and its descen dants)
115 LayoutObject* layoutObject = m_frameView.nodeToDraw() ? m_frameView.nodeToDr aw()->layoutObject() : 0; 115 LayoutObject* layoutObject = frameView().nodeToDraw() ? frameView().nodeToDr aw()->layoutObject() : 0;
116 DeprecatedPaintLayer* rootLayer = layoutView->layer(); 116 DeprecatedPaintLayer* rootLayer = layoutView->layer();
117 117
118 #if ENABLE(ASSERT) 118 #if ENABLE(ASSERT)
119 layoutView->assertSubtreeIsLaidOut(); 119 layoutView->assertSubtreeIsLaidOut();
120 LayoutObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer- >layoutObject()); 120 LayoutObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer- >layoutObject());
121 #endif 121 #endif
122 122
123 DeprecatedPaintLayerPainter layerPainter(*rootLayer); 123 DeprecatedPaintLayerPainter layerPainter(*rootLayer);
124 124
125 float deviceScaleFactor = blink::deviceScaleFactor(rootLayer->layoutObject() ->frame()); 125 float deviceScaleFactor = blink::deviceScaleFactor(rootLayer->layoutObject() ->frame());
126 context->setDeviceScaleFactor(deviceScaleFactor); 126 context->setDeviceScaleFactor(deviceScaleFactor);
127 127
128 layerPainter.paint(context, LayoutRect(rect), localPaintFlags, layoutObject) ; 128 layerPainter.paint(context, LayoutRect(rect), localPaintFlags, layoutObject) ;
129 129
130 if (rootLayer->containsDirtyOverlayScrollbars()) 130 if (rootLayer->containsDirtyOverlayScrollbars())
131 layerPainter.paintOverlayScrollbars(context, LayoutRect(rect), localPain tFlags, layoutObject); 131 layerPainter.paintOverlayScrollbars(context, LayoutRect(rect), localPain tFlags, layoutObject);
132 132
133 m_frameView.setIsPainting(false); 133 frameView().setIsPainting(false);
134 134
135 // Regions may have changed as a result of the visibility/z-index of element changing. 135 // Regions may have changed as a result of the visibility/z-index of element changing.
136 if (document->annotatedRegionsDirty()) 136 if (document->annotatedRegionsDirty())
137 m_frameView.updateDocumentAnnotatedRegions(); 137 frameView().updateDocumentAnnotatedRegions();
138 138
139 if (isTopLevelPainter) { 139 if (isTopLevelPainter) {
140 // Everything that happens after paintContents completions is considered 140 // Everything that happens after paintContents completions is considered
141 // to be part of the next frame. 141 // to be part of the next frame.
142 memoryCache()->updateFramePaintTimestamp(); 142 memoryCache()->updateFramePaintTimestamp();
143 s_inPaintContents = false; 143 s_inPaintContents = false;
144 } 144 }
145 145
146 InspectorInstrumentation::didPaint(layoutView, 0, context, LayoutRect(rect)) ; 146 InspectorInstrumentation::didPaint(layoutView, 0, context, LayoutRect(rect)) ;
147 } 147 }
148 148
149 void FramePainter::paintScrollbars(GraphicsContext* context, const IntRect& rect ) 149 void FramePainter::paintScrollbars(GraphicsContext* context, const IntRect& rect )
150 { 150 {
151 if (m_frameView.horizontalScrollbar() && !m_frameView.layerForHorizontalScro llbar()) 151 if (frameView().horizontalScrollbar() && !frameView().layerForHorizontalScro llbar())
152 paintScrollbar(context, m_frameView.horizontalScrollbar(), rect); 152 paintScrollbar(context, frameView().horizontalScrollbar(), rect);
153 if (m_frameView.verticalScrollbar() && !m_frameView.layerForVerticalScrollba r()) 153 if (frameView().verticalScrollbar() && !frameView().layerForVerticalScrollba r())
154 paintScrollbar(context, m_frameView.verticalScrollbar(), rect); 154 paintScrollbar(context, frameView().verticalScrollbar(), rect);
155 155
156 if (m_frameView.layerForScrollCorner()) 156 if (frameView().layerForScrollCorner())
157 return; 157 return;
158 158
159 paintScrollCorner(context, m_frameView.scrollCornerRect()); 159 paintScrollCorner(context, frameView().scrollCornerRect());
160 } 160 }
161 161
162 void FramePainter::paintScrollCorner(GraphicsContext* context, const IntRect& co rnerRect) 162 void FramePainter::paintScrollCorner(GraphicsContext* context, const IntRect& co rnerRect)
163 { 163 {
164 if (m_frameView.scrollCorner()) { 164 if (frameView().scrollCorner()) {
165 bool needsBackground = m_frameView.frame().isMainFrame(); 165 bool needsBackground = frameView().frame().isMainFrame();
166 if (needsBackground && !LayoutObjectDrawingRecorder::useCachedDrawingIfP ossible(*context, *m_frameView.layoutView(), DisplayItem::ScrollbarCorner, Layou tPoint())) { 166 if (needsBackground && !LayoutObjectDrawingRecorder::useCachedDrawingIfP ossible(*context, *frameView().layoutView(), DisplayItem::ScrollbarCorner, Layou tPoint())) {
167 LayoutObjectDrawingRecorder drawingRecorder(*context, *m_frameView.l ayoutView(), DisplayItem::ScrollbarCorner, FloatRect(cornerRect), LayoutPoint()) ; 167 LayoutObjectDrawingRecorder drawingRecorder(*context, *frameView().l ayoutView(), DisplayItem::ScrollbarCorner, FloatRect(cornerRect), LayoutPoint()) ;
168 context->fillRect(cornerRect, m_frameView.baseBackgroundColor()); 168 context->fillRect(cornerRect, frameView().baseBackgroundColor());
169 169
170 } 170 }
171 ScrollbarPainter::paintIntoRect(*m_frameView.scrollCorner(), context, co rnerRect.location(), LayoutRect(cornerRect)); 171 ScrollbarPainter::paintIntoRect(*frameView().scrollCorner(), context, co rnerRect.location(), LayoutRect(cornerRect));
172 return; 172 return;
173 } 173 }
174 174
175 ScrollbarTheme::theme()->paintScrollCorner(context, *m_frameView.layoutView( ), cornerRect); 175 ScrollbarTheme::theme()->paintScrollCorner(context, *frameView().layoutView( ), cornerRect);
176 } 176 }
177 177
178 void FramePainter::paintScrollbar(GraphicsContext* context, Scrollbar* bar, cons t IntRect& rect) 178 void FramePainter::paintScrollbar(GraphicsContext* context, Scrollbar* bar, cons t IntRect& rect)
179 { 179 {
180 bool needsBackground = bar->isCustomScrollbar() && m_frameView.frame().isMai nFrame(); 180 bool needsBackground = bar->isCustomScrollbar() && frameView().frame().isMai nFrame();
181 if (needsBackground) { 181 if (needsBackground) {
182 IntRect toFill = bar->frameRect(); 182 IntRect toFill = bar->frameRect();
183 toFill.intersect(rect); 183 toFill.intersect(rect);
184 context->fillRect(toFill, m_frameView.baseBackgroundColor()); 184 context->fillRect(toFill, frameView().baseBackgroundColor());
185 } 185 }
186 186
187 bar->paint(context, rect); 187 bar->paint(context, rect);
188 } 188 }
189 189
190 const FrameView& FramePainter::frameView()
191 {
192 ASSERT(m_frameView);
193 return *m_frameView;
194 }
195
190 } // namespace blink 196 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/FramePainter.h ('k') | third_party/WebKit/Source/core/paint/ScrollbarPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698