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

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

Issue 2715243004: [blink] Support (semi-)transparent background colors in WebView/Frame. (Closed)
Patch Set: address comments Created 3 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 m_layoutView.scrolledContentOffset()); 79 m_layoutView.scrolledContentOffset());
80 } 80 }
81 81
82 if (DrawingRecorder::useCachedDrawingIfPossible( 82 if (DrawingRecorder::useCachedDrawingIfPossible(
83 context, *displayItemClient, DisplayItem::kDocumentBackground)) 83 context, *displayItemClient, DisplayItem::kDocumentBackground))
84 return; 84 return;
85 85
86 const Document& document = m_layoutView.document(); 86 const Document& document = m_layoutView.document();
87 const FrameView& frameView = *m_layoutView.frameView(); 87 const FrameView& frameView = *m_layoutView.frameView();
88 bool isMainFrame = document.isInMainFrame(); 88 bool isMainFrame = document.isInMainFrame();
89 bool paintsBaseBackground = isMainFrame && !frameView.isTransparent(); 89 bool paintsBaseBackground =
90 isMainFrame && (frameView.baseBackgroundColor().alpha() > 0);
chrishtr 2017/03/28 19:45:55 This doesn't look right. hasAlpha() instead? Is th
Eric Seckler 2017/03/29 10:50:18 hasAlpha() == alpha() < 255, i.e. is true iff not-
chrishtr 2017/03/29 15:36:41 Ah I see now. The old code was calling isTranspare
90 bool shouldClearCanvas = 91 bool shouldClearCanvas =
91 paintsBaseBackground && 92 paintsBaseBackground &&
92 (document.settings() && 93 (document.settings() &&
93 document.settings()->getShouldClearDocumentBackground()); 94 document.settings()->getShouldClearDocumentBackground());
94 Color baseBackgroundColor = 95 Color baseBackgroundColor =
95 paintsBaseBackground ? frameView.baseBackgroundColor() : Color(); 96 paintsBaseBackground ? frameView.baseBackgroundColor() : Color();
96 Color rootBackgroundColor = 97 Color rootBackgroundColor =
97 m_layoutView.style()->visitedDependentColor(CSSPropertyBackgroundColor); 98 m_layoutView.style()->visitedDependentColor(CSSPropertyBackgroundColor);
98 const LayoutObject* rootObject = 99 const LayoutObject* rootObject =
99 document.documentElement() ? document.documentElement()->layoutObject() 100 document.documentElement() ? document.documentElement()->layoutObject()
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 LayoutRect(paintRect), BackgroundBleedNone); 224 LayoutRect(paintRect), BackgroundBleedNone);
224 context.restore(); 225 context.restore();
225 } 226 }
226 } 227 }
227 228
228 if (shouldDrawBackgroundInSeparateBuffer) 229 if (shouldDrawBackgroundInSeparateBuffer)
229 context.endLayer(); 230 context.endLayer();
230 } 231 }
231 232
232 } // namespace blink 233 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698