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

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

Issue 1391753005: (WIP) Invalidation during painting (for synchronized painting) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/ViewPainter.h" 5 #include "core/paint/ViewPainter.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/Settings.h" 8 #include "core/frame/Settings.h"
9 #include "core/layout/LayoutBox.h" 9 #include "core/layout/LayoutBox.h"
10 #include "core/layout/LayoutView.h" 10 #include "core/layout/LayoutView.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // 1. The view paints background for the root element, the background positi oning respects 42 // 1. The view paints background for the root element, the background positi oning respects
43 // the positioning and transformation of the root element. 43 // the positioning and transformation of the root element.
44 // 2. CSS background-clip is ignored, the background layers always expand to cover the whole 44 // 2. CSS background-clip is ignored, the background layers always expand to cover the whole
45 // canvas. None of the stacking context effects (except transformation) o n the root element 45 // canvas. None of the stacking context effects (except transformation) o n the root element
46 // affects the background. 46 // affects the background.
47 // 3. The main frame is also responsible for painting the user-agent-defined base background 47 // 3. The main frame is also responsible for painting the user-agent-defined base background
48 // color. Conceptually it should be painted by the embedder but painting it here allows 48 // color. Conceptually it should be painted by the embedder but painting it here allows
49 // culling and pre-blending optimization when possible. 49 // culling and pre-blending optimization when possible.
50 50
51 GraphicsContext& context = paintInfo.context; 51 GraphicsContext& context = paintInfo.context;
52 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, m_layou tView, DisplayItem::DocumentBackground, LayoutPoint())) 52 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, m_layou tView, DisplayItem::DocumentBackground))
53 return; 53 return;
54 54
55 // The background fill rect is the size of the LayoutView's main GraphicsLay er. 55 // The background fill rect is the size of the LayoutView's main GraphicsLay er.
56 IntRect backgroundRect = pixelSnappedIntRect(m_layoutView.layer()->boundingB oxForCompositing()); 56 IntRect backgroundRect = pixelSnappedIntRect(m_layoutView.layer()->boundingB oxForCompositing());
57 const Document& document = m_layoutView.document(); 57 const Document& document = m_layoutView.document();
58 const FrameView& frameView = *m_layoutView.frameView(); 58 const FrameView& frameView = *m_layoutView.frameView();
59 bool isMainFrame = !document.ownerElement(); 59 bool isMainFrame = !document.ownerElement();
60 bool paintsBaseBackground = isMainFrame && !frameView.isTransparent(); 60 bool paintsBaseBackground = isMainFrame && !frameView.isTransparent();
61 bool shouldClearCanvas = paintsBaseBackground && (document.settings() && doc ument.settings()->shouldClearDocumentBackground()); 61 bool shouldClearCanvas = paintsBaseBackground && (document.settings() && doc ument.settings()->shouldClearDocumentBackground());
62 Color baseBackgroundColor = paintsBaseBackground ? frameView.baseBackgroundC olor() : Color(); 62 Color baseBackgroundColor = paintsBaseBackground ? frameView.baseBackgroundC olor() : Color();
63 Color rootBackgroundColor = m_layoutView.style()->visitedDependentColor(CSSP ropertyBackgroundColor); 63 Color rootBackgroundColor = m_layoutView.style()->visitedDependentColor(CSSP ropertyBackgroundColor);
64 const LayoutObject* rootObject = document.documentElement() ? document.docum entElement()->layoutObject() : nullptr; 64 const LayoutObject* rootObject = document.documentElement() ? document.docum entElement()->layoutObject() : nullptr;
65 65
66 LayoutObjectDrawingRecorder recorder(context, m_layoutView, DisplayItem::Doc umentBackground, backgroundRect, LayoutPoint()); 66 LayoutObjectDrawingRecorder recorder(context, m_layoutView, DisplayItem::Doc umentBackground, backgroundRect);
67 67
68 // Special handling for print economy mode. 68 // Special handling for print economy mode.
69 bool forceBackgroundToWhite = BoxPainter::shouldForceWhiteBackgroundForPrint Economy(m_layoutView.styleRef(), document); 69 bool forceBackgroundToWhite = BoxPainter::shouldForceWhiteBackgroundForPrint Economy(m_layoutView.styleRef(), document);
70 if (forceBackgroundToWhite) { 70 if (forceBackgroundToWhite) {
71 // If for any reason the view background is not transparent, paint white instead, otherwise keep transparent as is. 71 // If for any reason the view background is not transparent, paint white instead, otherwise keep transparent as is.
72 if (paintsBaseBackground || rootBackgroundColor.alpha() || m_layoutView. style()->backgroundLayers().image()) 72 if (paintsBaseBackground || rootBackgroundColor.alpha() || m_layoutView. style()->backgroundLayers().image())
73 context.fillRect(backgroundRect, Color::white, SkXfermode::kSrc_Mode ); 73 context.fillRect(backgroundRect, Color::white, SkXfermode::kSrc_Mode );
74 return; 74 return;
75 } 75 }
76 76
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 BoxPainter::paintFillLayer(m_layoutView, paintInfo, Color(), **it, L ayoutRect(paintRect), BackgroundBleedNone); 151 BoxPainter::paintFillLayer(m_layoutView, paintInfo, Color(), **it, L ayoutRect(paintRect), BackgroundBleedNone);
152 context.restore(); 152 context.restore();
153 } 153 }
154 } 154 }
155 155
156 if (shouldDrawBackgroundInSeparateBuffer) 156 if (shouldDrawBackgroundInSeparateBuffer)
157 context.endLayer(); 157 context.endLayer();
158 } 158 }
159 159
160 } // namespace blink 160 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/VideoPainter.cpp ('k') | third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698