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

Side by Side Diff: Source/core/paint/LayerPainter.cpp

Issue 801053005: [New Multicolumn] Render transformed layers into multiple fragments. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase master Created 5 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
« no previous file with comments | « Source/core/paint/LayerPainter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "core/paint/LayerPainter.h" 6 #include "core/paint/LayerPainter.h"
7 7
8 #include "core/frame/Settings.h" 8 #include "core/frame/Settings.h"
9 #include "core/layout/ClipPathOperation.h" 9 #include "core/layout/ClipPathOperation.h"
10 #include "core/layout/FilterEffectRenderer.h" 10 #include "core/layout/FilterEffectRenderer.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 // PaintLayerAppliedTransform is used in RenderReplica, to avoid applying th e transform twice. 82 // PaintLayerAppliedTransform is used in RenderReplica, to avoid applying th e transform twice.
83 if (m_renderLayer.paintsWithTransform(paintingInfo.paintBehavior) && !(paint Flags & PaintLayerAppliedTransform)) { 83 if (m_renderLayer.paintsWithTransform(paintingInfo.paintBehavior) && !(paint Flags & PaintLayerAppliedTransform)) {
84 paintLayerWithTransform(context, paintingInfo, paintFlags); 84 paintLayerWithTransform(context, paintingInfo, paintFlags);
85 return; 85 return;
86 } 86 }
87 87
88 paintLayerContentsAndReflection(context, paintingInfo, paintFlags); 88 paintLayerContentsAndReflection(context, paintingInfo, paintFlags);
89 } 89 }
90 90
91 void LayerPainter::paintLayerContentsAndReflection(GraphicsContext* context, con st LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 91 void LayerPainter::paintLayerContentsAndReflection(GraphicsContext* context, con st LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, FragmentPolicy f ragmentPolicy)
92 { 92 {
93 ASSERT(m_renderLayer.isSelfPaintingLayer() || m_renderLayer.hasSelfPaintingL ayerDescendant()); 93 ASSERT(m_renderLayer.isSelfPaintingLayer() || m_renderLayer.hasSelfPaintingL ayerDescendant());
94 94
95 PaintLayerFlags localPaintFlags = paintFlags & ~(PaintLayerAppliedTransform) ; 95 PaintLayerFlags localPaintFlags = paintFlags & ~(PaintLayerAppliedTransform) ;
96 96
97 // Paint the reflection first if we have one. 97 // Paint the reflection first if we have one.
98 if (m_renderLayer.reflectionInfo()) 98 if (m_renderLayer.reflectionInfo())
99 m_renderLayer.reflectionInfo()->paint(context, paintingInfo, localPaintF lags | PaintLayerPaintingReflection); 99 m_renderLayer.reflectionInfo()->paint(context, paintingInfo, localPaintF lags | PaintLayerPaintingReflection);
100 100
101 localPaintFlags |= PaintLayerPaintingCompositingAllPhases; 101 localPaintFlags |= PaintLayerPaintingCompositingAllPhases;
102 paintLayerContents(context, paintingInfo, localPaintFlags); 102 paintLayerContents(context, paintingInfo, localPaintFlags, fragmentPolicy);
103 } 103 }
104 104
105 class ClipPathHelper { 105 class ClipPathHelper {
106 public: 106 public:
107 ClipPathHelper(GraphicsContext* context, const Layer& renderLayer, const Lay erPaintingInfo& paintingInfo, LayoutRect& rootRelativeBounds, bool& rootRelative BoundsComputed, 107 ClipPathHelper(GraphicsContext* context, const Layer& renderLayer, const Lay erPaintingInfo& paintingInfo, LayoutRect& rootRelativeBounds, bool& rootRelative BoundsComputed,
108 const LayoutPoint& offsetFromRoot, PaintLayerFlags paintFlags) 108 const LayoutPoint& offsetFromRoot, PaintLayerFlags paintFlags)
109 : m_resourceClipper(0), m_clipStateSaver(*context, false), m_renderLayer (renderLayer), m_context(context) 109 : m_resourceClipper(0), m_clipStateSaver(*context, false), m_renderLayer (renderLayer), m_context(context)
110 { 110 {
111 const RenderStyle& style = renderLayer.renderer()->styleRef(); 111 const RenderStyle& style = renderLayer.renderer()->styleRef();
112 112
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 private: 163 private:
164 RenderSVGResourceClipper* m_resourceClipper; 164 RenderSVGResourceClipper* m_resourceClipper;
165 GraphicsContextStateSaver m_clipStateSaver; 165 GraphicsContextStateSaver m_clipStateSaver;
166 OwnPtr<ClipPathRecorder> m_clipPathRecorder; 166 OwnPtr<ClipPathRecorder> m_clipPathRecorder;
167 RenderSVGResourceClipper::ClipperState m_clipperState; 167 RenderSVGResourceClipper::ClipperState m_clipperState;
168 const Layer& m_renderLayer; 168 const Layer& m_renderLayer;
169 GraphicsContext* m_context; 169 GraphicsContext* m_context;
170 }; 170 };
171 171
172 void LayerPainter::paintLayerContents(GraphicsContext* context, const LayerPaint ingInfo& paintingInfo, PaintLayerFlags paintFlags) 172 void LayerPainter::paintLayerContents(GraphicsContext* context, const LayerPaint ingInfo& paintingInfo, PaintLayerFlags paintFlags, FragmentPolicy fragmentPolicy )
173 { 173 {
174 ASSERT(m_renderLayer.isSelfPaintingLayer() || m_renderLayer.hasSelfPaintingL ayerDescendant()); 174 ASSERT(m_renderLayer.isSelfPaintingLayer() || m_renderLayer.hasSelfPaintingL ayerDescendant());
175 ASSERT(!(paintFlags & PaintLayerAppliedTransform)); 175 ASSERT(!(paintFlags & PaintLayerAppliedTransform));
176 176
177 bool isSelfPaintingLayer = m_renderLayer.isSelfPaintingLayer(); 177 bool isSelfPaintingLayer = m_renderLayer.isSelfPaintingLayer();
178 bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScr ollbars; 178 bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScr ollbars;
179 bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositing ScrollingPhase; 179 bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositing ScrollingPhase;
180 bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingComposi tingForegroundPhase; 180 bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingComposi tingForegroundPhase;
181 bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingComposi tingBackgroundPhase; 181 bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingComposi tingBackgroundPhase;
182 bool isPaintingOverflowContents = paintFlags & PaintLayerPaintingOverflowCon tents; 182 bool isPaintingOverflowContents = paintFlags & PaintLayerPaintingOverflowCon tents;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 compositingRecorder = adoptPtr(new CompositingRecorder(context, m_render Layer.renderer()->displayItemClient(), 224 compositingRecorder = adoptPtr(new CompositingRecorder(context, m_render Layer.renderer()->displayItemClient(),
225 context->compositeOperationDeprecated(), m_renderLayer.renderer()->s tyle()->blendMode(), m_renderLayer.renderer()->opacity(), context->compositeOper ationDeprecated())); 225 context->compositeOperationDeprecated(), m_renderLayer.renderer()->s tyle()->blendMode(), m_renderLayer.renderer()->opacity(), context->compositeOper ationDeprecated()));
226 } 226 }
227 227
228 LayerPaintingInfo localPaintingInfo(paintingInfo); 228 LayerPaintingInfo localPaintingInfo(paintingInfo);
229 229
230 LayerFragments layerFragments; 230 LayerFragments layerFragments;
231 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { 231 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) {
232 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment. 232 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment.
233 m_renderLayer.collectFragments(layerFragments, localPaintingInfo.rootLay er, localPaintingInfo.paintDirtyRect, 233 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects ) ? UncachedClipRects : PaintingClipRects;
234 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai ntingClipRects, IgnoreOverlayScrollbarSize, 234 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowCli p(paintFlags, m_renderLayer.renderer());
235 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &of fsetFromRoot, localPaintingInfo.subPixelAccumulation); 235 if (fragmentPolicy == ForceSingleFragment)
236 m_renderLayer.appendSingleFragmentIgnoringPagination(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, Ignor eOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.s ubPixelAccumulation);
237 else
238 m_renderLayer.collectFragments(layerFragments, localPaintingInfo.roo tLayer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation);
236 if (shouldPaintContent) 239 if (shouldPaintContent)
237 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra gments, localPaintingInfo, paintFlags, offsetFromRoot); 240 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra gments, localPaintingInfo, paintFlags, offsetFromRoot);
238 } 241 }
239 242
240 bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelectio nOnly; 243 bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelectio nOnly;
241 // If this layer's renderer is a child of the paintingRoot, we render uncond itionally, which 244 // If this layer's renderer is a child of the paintingRoot, we render uncond itionally, which
242 // is done by passing a nil paintingRoot down to our renderer (as if no pain tingRoot was ever set). 245 // is done by passing a nil paintingRoot down to our renderer (as if no pain tingRoot was ever set).
243 // Else, our renderer tree may or may not contain the painting root, so we p ass that root along 246 // Else, our renderer tree may or may not contain the painting root, so we p ass that root along
244 // so it will be tested against as we descend through the renderers. 247 // so it will be tested against as we descend through the renderers.
245 LayoutObject* paintingRootForRenderer = 0; 248 LayoutObject* paintingRootForRenderer = 0;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 TransformationMatrix transform(m_renderLayer.renderableTransform(paintingInf o.paintBehavior)); 397 TransformationMatrix transform(m_renderLayer.renderableTransform(paintingInf o.paintBehavior));
395 IntPoint roundedDelta = roundedIntPoint(delta); 398 IntPoint roundedDelta = roundedIntPoint(delta);
396 transform.translateRight(roundedDelta.x(), roundedDelta.y()); 399 transform.translateRight(roundedDelta.x(), roundedDelta.y());
397 LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation + (delta - roundedDelta); 400 LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation + (delta - roundedDelta);
398 401
399 Transform3DRecorder transform3DRecorder(*context, m_renderLayer.renderer()-> displayItemClient(), transform); 402 Transform3DRecorder transform3DRecorder(*context, m_renderLayer.renderer()-> displayItemClient(), transform);
400 403
401 // Now do a paint with the root layer shifted to be us. 404 // Now do a paint with the root layer shifted to be us.
402 LayerPaintingInfo transformedPaintingInfo(&m_renderLayer, enclosingIntRect(t ransform.inverse().mapRect(paintingInfo.paintDirtyRect)), paintingInfo.paintBeha vior, 405 LayerPaintingInfo transformedPaintingInfo(&m_renderLayer, enclosingIntRect(t ransform.inverse().mapRect(paintingInfo.paintDirtyRect)), paintingInfo.paintBeha vior,
403 adjustedSubPixelAccumulation, paintingInfo.paintingRoot); 406 adjustedSubPixelAccumulation, paintingInfo.paintingRoot);
404 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags ); 407 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags , ForceSingleFragment);
405 } 408 }
406 409
407 void LayerPainter::paintChildren(unsigned childrenToVisit, GraphicsContext* cont ext, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 410 void LayerPainter::paintChildren(unsigned childrenToVisit, GraphicsContext* cont ext, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
408 { 411 {
409 if (!m_renderLayer.hasSelfPaintingLayerDescendant()) 412 if (!m_renderLayer.hasSelfPaintingLayerDescendant())
410 return; 413 return;
411 414
412 #if ENABLE(ASSERT) 415 #if ENABLE(ASSERT)
413 LayerListMutationDetector mutationChecker(m_renderLayer.stackingNode()); 416 LayerListMutationDetector mutationChecker(m_renderLayer.stackingNode());
414 #endif 417 #endif
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 if (!m_renderLayer.containsDirtyOverlayScrollbars()) 713 if (!m_renderLayer.containsDirtyOverlayScrollbars())
711 return; 714 return;
712 715
713 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), paintingRoot); 716 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), paintingRoot);
714 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 717 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
715 718
716 m_renderLayer.setContainsDirtyOverlayScrollbars(false); 719 m_renderLayer.setContainsDirtyOverlayScrollbars(false);
717 } 720 }
718 721
719 } // namespace blink 722 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/LayerPainter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698