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

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: Add tests and sync to head. Created 3 years, 10 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())
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 && effect->requiresCompositingForAnimation()) ||
82 (transform && transform->requiresCompositingForAnimation())) {
83 return false;
84 }
85 }
75 86
76 // 0.0004f < 1/2048. With 10-bit color channels (only available on the 87 // 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 88 // 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 89 // less leads to a color output of less than 0.5 in all channels, hence
79 // not visible. 90 // not visible.
80 static const float kMinimumVisibleOpacity = 0.0004f; 91 static const float kMinimumVisibleOpacity = 0.0004f;
81 if (m_paintLayer.paintsWithTransparency(paintingInfo.getGlobalPaintFlags())) { 92 if (m_paintLayer.paintsWithTransparency(paintingInfo.getGlobalPaintFlags())) {
82 if (m_paintLayer.layoutObject()->styleRef().opacity() < 93 if (layoutObject.styleRef().opacity() < kMinimumVisibleOpacity) {
83 kMinimumVisibleOpacity) {
84 return true; 94 return true;
85 } 95 }
86 } 96 }
87 return false; 97 return false;
88 } 98 }
89 99
90 PaintResult PaintLayerPainter::paint(GraphicsContext& context, 100 PaintResult PaintLayerPainter::paint(GraphicsContext& context,
91 const PaintLayerPaintingInfo& paintingInfo, 101 const PaintLayerPaintingInfo& paintingInfo,
92 PaintLayerFlags paintFlags) { 102 PaintLayerFlags paintFlags) {
93 // https://code.google.com/p/chromium/issues/detail?id=343772 103 // 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)) 1188 context, layoutObject, PaintPhaseClippingMask))
1179 return; 1189 return;
1180 1190
1181 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect()); 1191 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect());
1182 LayoutObjectDrawingRecorder drawingRecorder( 1192 LayoutObjectDrawingRecorder drawingRecorder(
1183 context, layoutObject, PaintPhaseClippingMask, snappedClipRect); 1193 context, layoutObject, PaintPhaseClippingMask, snappedClipRect);
1184 context.fillRect(snappedClipRect, Color::black); 1194 context.fillRect(snappedClipRect, Color::black);
1185 } 1195 }
1186 1196
1187 } // namespace blink 1197 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698