| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 properties.transform = transform; | 54 properties.transform = transform; |
| 55 if (clip) | 55 if (clip) |
| 56 properties.clip = clip; | 56 properties.clip = clip; |
| 57 scopedPaintChunkProperties.emplace(context.getPaintController(),
*frameView().layoutView(), properties); | 57 scopedPaintChunkProperties.emplace(context.getPaintController(),
*frameView().layoutView(), properties); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 TransformRecorder transformRecorder(context, *frameView().layoutView(), | 61 TransformRecorder transformRecorder(context, *frameView().layoutView(), |
| 62 AffineTransform::translation(frameView().x() - frameView().scrollX()
, frameView().y() - frameView().scrollY())); | 62 AffineTransform::translation(frameView().x() - frameView().scrollX()
, frameView().y() - frameView().scrollY())); |
| 63 | 63 |
| 64 ClipRecorder recorder(context, *frameView().layoutView(), DisplayItem::C
lipFrameToVisibleContentRect, frameView().visibleContentRect()); | 64 ClipRecorder recorder(context, *frameView().layoutView(), DisplayItem::k
ClipFrameToVisibleContentRect, frameView().visibleContentRect()); |
| 65 | 65 |
| 66 documentDirtyRect.moveBy(-frameView().location() + frameView().scrollPos
ition()); | 66 documentDirtyRect.moveBy(-frameView().location() + frameView().scrollPos
ition()); |
| 67 paintContents(context, globalPaintFlags, documentDirtyRect); | 67 paintContents(context, globalPaintFlags, documentDirtyRect); |
| 68 } | 68 } |
| 69 | 69 |
| 70 if (shouldPaintScrollbars) { | 70 if (shouldPaintScrollbars) { |
| 71 IntRect scrollViewDirtyRect = rect.m_rect; | 71 IntRect scrollViewDirtyRect = rect.m_rect; |
| 72 IntRect visibleAreaWithScrollbars(frameView().location(), frameView().vi
sibleContentRect(IncludeScrollbars).size()); | 72 IntRect visibleAreaWithScrollbars(frameView().location(), frameView().vi
sibleContentRect(IncludeScrollbars).size()); |
| 73 scrollViewDirtyRect.intersect(visibleAreaWithScrollbars); | 73 scrollViewDirtyRect.intersect(visibleAreaWithScrollbars); |
| 74 scrollViewDirtyRect.moveBy(-frameView().location()); | 74 scrollViewDirtyRect.moveBy(-frameView().location()); |
| 75 | 75 |
| 76 Optional<ScopedPaintChunkProperties> scopedPaintChunkProperties; | 76 Optional<ScopedPaintChunkProperties> scopedPaintChunkProperties; |
| 77 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 77 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 78 if (TransformPaintPropertyNode* transform = m_frameView->preTranslat
ion()) { | 78 if (TransformPaintPropertyNode* transform = m_frameView->preTranslat
ion()) { |
| 79 PaintChunkProperties properties(context.getPaintController().cur
rentPaintChunkProperties()); | 79 PaintChunkProperties properties(context.getPaintController().cur
rentPaintChunkProperties()); |
| 80 properties.transform = transform; | 80 properties.transform = transform; |
| 81 scopedPaintChunkProperties.emplace(context.getPaintController(),
*frameView().layoutView(), properties); | 81 scopedPaintChunkProperties.emplace(context.getPaintController(),
*frameView().layoutView(), properties); |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 TransformRecorder transformRecorder(context, *frameView().layoutView(), | 85 TransformRecorder transformRecorder(context, *frameView().layoutView(), |
| 86 AffineTransform::translation(frameView().x(), frameView().y())); | 86 AffineTransform::translation(frameView().x(), frameView().y())); |
| 87 | 87 |
| 88 ClipRecorder recorder(context, *frameView().layoutView(), DisplayItem::C
lipFrameScrollbars, IntRect(IntPoint(), visibleAreaWithScrollbars.size())); | 88 ClipRecorder recorder(context, *frameView().layoutView(), DisplayItem::k
ClipFrameScrollbars, IntRect(IntPoint(), visibleAreaWithScrollbars.size())); |
| 89 | 89 |
| 90 paintScrollbars(context, scrollViewDirtyRect); | 90 paintScrollbars(context, scrollViewDirtyRect); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 void FramePainter::paintContents(GraphicsContext& context, const GlobalPaintFlag
s globalPaintFlags, const IntRect& rect) | 94 void FramePainter::paintContents(GraphicsContext& context, const GlobalPaintFlag
s globalPaintFlags, const IntRect& rect) |
| 95 { | 95 { |
| 96 Document* document = frameView().frame().document(); | 96 Document* document = frameView().frame().document(); |
| 97 | 97 |
| 98 if (frameView().shouldThrottleRendering() || !document->isActive()) | 98 if (frameView().shouldThrottleRendering() || !document->isActive()) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 if (frameView().layerForScrollCorner()) | 166 if (frameView().layerForScrollCorner()) |
| 167 return; | 167 return; |
| 168 | 168 |
| 169 paintScrollCorner(context, frameView().scrollCornerRect()); | 169 paintScrollCorner(context, frameView().scrollCornerRect()); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void FramePainter::paintScrollCorner(GraphicsContext& context, const IntRect& co
rnerRect) | 172 void FramePainter::paintScrollCorner(GraphicsContext& context, const IntRect& co
rnerRect) |
| 173 { | 173 { |
| 174 if (frameView().scrollCorner()) { | 174 if (frameView().scrollCorner()) { |
| 175 bool needsBackground = frameView().frame().isMainFrame(); | 175 bool needsBackground = frameView().frame().isMainFrame(); |
| 176 if (needsBackground && !LayoutObjectDrawingRecorder::useCachedDrawingIfP
ossible(context, *frameView().layoutView(), DisplayItem::ScrollbarCorner)) { | 176 if (needsBackground && !LayoutObjectDrawingRecorder::useCachedDrawingIfP
ossible(context, *frameView().layoutView(), DisplayItem::kScrollbarCorner)) { |
| 177 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().la
youtView(), DisplayItem::ScrollbarCorner, FloatRect(cornerRect)); | 177 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().la
youtView(), DisplayItem::kScrollbarCorner, FloatRect(cornerRect)); |
| 178 context.fillRect(cornerRect, frameView().baseBackgroundColor()); | 178 context.fillRect(cornerRect, frameView().baseBackgroundColor()); |
| 179 | 179 |
| 180 } | 180 } |
| 181 ScrollbarPainter::paintIntoRect(*frameView().scrollCorner(), context, co
rnerRect.location(), LayoutRect(cornerRect)); | 181 ScrollbarPainter::paintIntoRect(*frameView().scrollCorner(), context, co
rnerRect.location(), LayoutRect(cornerRect)); |
| 182 return; | 182 return; |
| 183 } | 183 } |
| 184 | 184 |
| 185 ScrollbarTheme::theme().paintScrollCorner(context, *frameView().layoutView()
, cornerRect); | 185 ScrollbarTheme::theme().paintScrollCorner(context, *frameView().layoutView()
, cornerRect); |
| 186 } | 186 } |
| 187 | 187 |
| 188 void FramePainter::paintScrollbar(GraphicsContext& context, Scrollbar& bar, cons
t IntRect& rect) | 188 void FramePainter::paintScrollbar(GraphicsContext& context, Scrollbar& bar, cons
t IntRect& rect) |
| 189 { | 189 { |
| 190 bool needsBackground = bar.isCustomScrollbar() && frameView().frame().isMain
Frame(); | 190 bool needsBackground = bar.isCustomScrollbar() && frameView().frame().isMain
Frame(); |
| 191 if (needsBackground) { | 191 if (needsBackground) { |
| 192 IntRect toFill = bar.frameRect(); | 192 IntRect toFill = bar.frameRect(); |
| 193 toFill.intersect(rect); | 193 toFill.intersect(rect); |
| 194 context.fillRect(toFill, frameView().baseBackgroundColor()); | 194 context.fillRect(toFill, frameView().baseBackgroundColor()); |
| 195 } | 195 } |
| 196 | 196 |
| 197 bar.paint(context, CullRect(rect)); | 197 bar.paint(context, CullRect(rect)); |
| 198 } | 198 } |
| 199 | 199 |
| 200 const FrameView& FramePainter::frameView() | 200 const FrameView& FramePainter::frameView() |
| 201 { | 201 { |
| 202 ASSERT(m_frameView); | 202 ASSERT(m_frameView); |
| 203 return *m_frameView; | 203 return *m_frameView; |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace blink | 206 } // namespace blink |
| OLD | NEW |