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

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

Issue 2652273004: Paint invisible layer content in presence of composited animations. (Closed)
Patch Set: Created 3 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/PaintLayerPainter.h" 5 #include "core/paint/PaintLayerPainter.h"
6 6
7 #include "core/frame/LocalFrame.h" 7 #include "core/frame/LocalFrame.h"
8 #include "core/layout/LayoutView.h" 8 #include "core/layout/LayoutView.h"
9 #include "core/paint/ClipPathClipper.h" 9 #include "core/paint/ClipPathClipper.h"
10 #include "core/paint/FilterPainter.h" 10 #include "core/paint/FilterPainter.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 const LayoutObject* layoutObject) { 59 const LayoutObject* layoutObject) {
60 return (paintFlags & PaintLayerPaintingOverflowContents || 60 return (paintFlags & PaintLayerPaintingOverflowContents ||
61 (paintFlags & PaintLayerPaintingChildClippingMaskPhase && 61 (paintFlags & PaintLayerPaintingChildClippingMaskPhase &&
62 layoutObject->hasClipPath())) 62 layoutObject->hasClipPath()))
63 ? IgnoreOverflowClip 63 ? IgnoreOverflowClip
64 : RespectOverflowClip; 64 : RespectOverflowClip;
65 } 65 }
66 66
67 bool PaintLayerPainter::paintedOutputInvisible( 67 bool PaintLayerPainter::paintedOutputInvisible(
68 const PaintLayerPaintingInfo& paintingInfo) { 68 const PaintLayerPaintingInfo& paintingInfo) {
69 if (m_paintLayer.layoutObject()->hasBackdropFilter()) 69 const LayoutObject& layoutObject = *m_paintLayer.layoutObject();
70 if (layoutObject.hasBackdropFilter())
70 return false; 71 return false;
71 72
72 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && 73 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
73 m_paintLayer.layoutObject()->styleRef().opacity()) 74 if (layoutObject.styleRef().opacity())
pdr. 2017/01/26 22:50:38 Do you need to check opacity > kMinimumVisibleOpac
wkorman 2017/01/26 23:09:12 http://crrev.com/2523103003 added PaintLayerPainte
74 return false; 75 return false;
76
77 const EffectPaintPropertyNode* effect =
78 layoutObject.paintProperties()->effect();
79 const TransformPaintPropertyNode* transform =
80 layoutObject.paintProperties()->transform();
81 if ((effect &&
82 (effect->compositingReasons() & CompositingReasonActiveAnimation)) ||
83 (transform && (transform->compositingReasons() &
84 CompositingReasonActiveAnimation))) {
85 return false;
86 }
87 }
75 88
76 // 0.0004f < 1/2048. With 10-bit color channels (only available on the 89 // 0.0004f < 1/2048. With 10-bit color channels (only available on the
77 // newest Macs; otherwise it's 8-bit), we see that an alpha of 1/2048 or 90 // newest Macs; otherwise it's 8-bit), we see that an alpha of 1/2048 or
78 // less leads to a color output of less than 0.5 in all channels, hence 91 // less leads to a color output of less than 0.5 in all channels, hence
79 // not visible. 92 // not visible.
80 static const float kMinimumVisibleOpacity = 0.0004f; 93 static const float kMinimumVisibleOpacity = 0.0004f;
81 if (m_paintLayer.paintsWithTransparency(paintingInfo.getGlobalPaintFlags())) { 94 if (m_paintLayer.paintsWithTransparency(paintingInfo.getGlobalPaintFlags())) {
82 if (m_paintLayer.layoutObject()->styleRef().opacity() < 95 if (layoutObject.styleRef().opacity() < kMinimumVisibleOpacity) {
83 kMinimumVisibleOpacity) {
84 return true; 96 return true;
85 } 97 }
86 } 98 }
87 return false; 99 return false;
88 } 100 }
89 101
90 PaintResult PaintLayerPainter::paint(GraphicsContext& context, 102 PaintResult PaintLayerPainter::paint(GraphicsContext& context,
91 const PaintLayerPaintingInfo& paintingInfo, 103 const PaintLayerPaintingInfo& paintingInfo,
92 PaintLayerFlags paintFlags) { 104 PaintLayerFlags paintFlags) {
93 // https://code.google.com/p/chromium/issues/detail?id=343772 105 // https://code.google.com/p/chromium/issues/detail?id=343772
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 context, layoutObject, PaintPhaseClippingMask)) 1190 context, layoutObject, PaintPhaseClippingMask))
1179 return; 1191 return;
1180 1192
1181 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect()); 1193 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect());
1182 LayoutObjectDrawingRecorder drawingRecorder( 1194 LayoutObjectDrawingRecorder drawingRecorder(
1183 context, layoutObject, PaintPhaseClippingMask, snappedClipRect); 1195 context, layoutObject, PaintPhaseClippingMask, snappedClipRect);
1184 context.fillRect(snappedClipRect, Color::black); 1196 context.fillRect(snappedClipRect, Color::black);
1185 } 1197 }
1186 1198
1187 } // namespace blink 1199 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698