OLD | NEW |
---|---|
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/DeprecatedPaintLayerPainter.h" | 6 #include "core/paint/DeprecatedPaintLayerPainter.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/LayoutBlock.h" | 10 #include "core/layout/LayoutBlock.h" |
11 #include "core/layout/LayoutView.h" | 11 #include "core/layout/LayoutView.h" |
12 #include "core/layout/svg/LayoutSVGResourceClipper.h" | 12 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
13 #include "core/page/Page.h" | 13 #include "core/page/Page.h" |
14 #include "core/paint/CompositingRecorder.h" | 14 #include "core/paint/CompositingRecorder.h" |
15 #include "core/paint/DeprecatedPaintLayer.h" | 15 #include "core/paint/DeprecatedPaintLayer.h" |
16 #include "core/paint/FilterPainter.h" | 16 #include "core/paint/FilterPainter.h" |
17 #include "core/paint/LayerClipRecorder.h" | 17 #include "core/paint/LayerClipRecorder.h" |
18 #include "core/paint/LayerFixedPositionRecorder.h" | 18 #include "core/paint/LayerFixedPositionRecorder.h" |
19 #include "core/paint/PaintInfo.h" | 19 #include "core/paint/PaintInfo.h" |
20 #include "core/paint/SVGClipPainter.h" | 20 #include "core/paint/SVGClipPainter.h" |
21 #include "core/paint/ScopeRecorder.h" | 21 #include "core/paint/ScopeRecorder.h" |
22 #include "core/paint/ScrollRecorder.h" | 22 #include "core/paint/ScrollRecorder.h" |
23 #include "core/paint/ScrollableAreaPainter.h" | 23 #include "core/paint/ScrollableAreaPainter.h" |
24 #include "core/paint/Transform3DRecorder.h" | 24 #include "core/paint/Transform3DRecorder.h" |
25 #include "core/paint/TransformRecorder.h" | |
25 #include "platform/graphics/GraphicsLayer.h" | 26 #include "platform/graphics/GraphicsLayer.h" |
26 #include "platform/graphics/paint/ClipPathRecorder.h" | 27 #include "platform/graphics/paint/ClipPathRecorder.h" |
27 #include "platform/graphics/paint/ClipRecorder.h" | 28 #include "platform/graphics/paint/ClipRecorder.h" |
28 #include "platform/graphics/paint/CompositingDisplayItem.h" | 29 #include "platform/graphics/paint/CompositingDisplayItem.h" |
30 #include "platform/graphics/paint/FixedPositionContainerDisplayItem.h" | |
29 #include "platform/graphics/paint/SubsequenceRecorder.h" | 31 #include "platform/graphics/paint/SubsequenceRecorder.h" |
30 #include "platform/graphics/paint/Transform3DDisplayItem.h" | 32 #include "platform/graphics/paint/Transform3DDisplayItem.h" |
31 #include "wtf/Optional.h" | 33 #include "wtf/Optional.h" |
32 | 34 |
33 namespace blink { | 35 namespace blink { |
34 | 36 |
35 static inline bool shouldSuppressPaintingLayer(DeprecatedPaintLayer* layer) | 37 static inline bool shouldSuppressPaintingLayer(DeprecatedPaintLayer* layer) |
36 { | 38 { |
37 // Avoid painting descendants of the root layer when stylesheets haven't loa ded. This eliminates FOUC. | 39 // Avoid painting descendants of the root layer when stylesheets haven't loa ded. This eliminates FOUC. |
38 // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document | 40 // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()- >hasBackdropFilter()) | 86 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()- >hasBackdropFilter()) |
85 return; | 87 return; |
86 | 88 |
87 if (!needsRepaint && SubsequenceRecorder::useCachedSubsequenceIfPossible(*co ntext, *m_paintLayer.layoutObject())) | 89 if (!needsRepaint && SubsequenceRecorder::useCachedSubsequenceIfPossible(*co ntext, *m_paintLayer.layoutObject())) |
88 return; | 90 return; |
89 SubsequenceRecorder subsequenceRecorder(*context, *m_paintLayer.layoutObject ()); | 91 SubsequenceRecorder subsequenceRecorder(*context, *m_paintLayer.layoutObject ()); |
90 | 92 |
91 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) | 93 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) |
92 paintFlags |= PaintLayerHaveTransparency; | 94 paintFlags |= PaintLayerHaveTransparency; |
93 | 95 |
94 LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.lay outObject()); | |
95 | |
96 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th e transform twice. | 96 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th e transform twice. |
97 if (m_paintLayer.paintsWithTransform(paintingInfo.globalPaintFlags()) && !(p aintFlags & PaintLayerAppliedTransform)) { | 97 if (m_paintLayer.paintsWithTransform(paintingInfo.globalPaintFlags()) && !(p aintFlags & PaintLayerAppliedTransform)) { |
98 paintLayerWithTransform(context, paintingInfo, paintFlags); | 98 paintLayerWithTransform(context, paintingInfo, paintFlags); |
99 return; | 99 return; |
100 } | 100 } |
101 | 101 |
102 paintLayerContentsAndReflection(context, paintingInfo, paintFlags); | 102 paintLayerContentsAndReflection(context, paintingInfo, paintFlags); |
103 } | 103 } |
104 | 104 |
105 void DeprecatedPaintLayerPainter::paintLayerContentsAndReflection(GraphicsContex t* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlag s paintFlags, FragmentPolicy fragmentPolicy) | 105 void DeprecatedPaintLayerPainter::paintLayerContentsAndReflection(GraphicsContex t* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlag s paintFlags, FragmentPolicy fragmentPolicy) |
106 { | 106 { |
107 ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLay erDescendant()); | 107 ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLay erDescendant()); |
108 | 108 |
109 PaintLayerFlags localPaintFlags = paintFlags & ~(PaintLayerAppliedTransform) ; | 109 PaintLayerFlags localPaintFlags = paintFlags & ~(PaintLayerAppliedTransform) ; |
110 | 110 |
111 // Paint the reflection first if we have one. | 111 // Paint the reflection first if we have one. |
112 if (m_paintLayer.reflectionInfo()) { | 112 if (m_paintLayer.reflectionInfo()) { |
113 ScopeRecorder scopeRecorder(*context); | 113 ScopeRecorder scopeRecorder(*context); |
114 m_paintLayer.reflectionInfo()->paint(context, paintingInfo, localPaintFl ags | PaintLayerPaintingReflection); | 114 m_paintLayer.reflectionInfo()->paint(context, paintingInfo, localPaintFl ags | PaintLayerPaintingReflection); |
115 } | 115 } |
116 | 116 |
117 localPaintFlags |= PaintLayerPaintingCompositingAllPhases; | 117 localPaintFlags |= PaintLayerPaintingCompositingAllPhases; |
118 paintLayerContents(context, paintingInfo, localPaintFlags, fragmentPolicy); | 118 paintLayerContents(context, paintingInfo, localPaintFlags, fragmentPolicy); |
119 } | 119 } |
120 | 120 |
121 class ClipPathHelper { | 121 class ClipPathHelper { |
122 public: | 122 public: |
123 ClipPathHelper(GraphicsContext* context, const DeprecatedPaintLayer& paintLa yer, const DeprecatedPaintLayerPaintingInfo& paintingInfo, LayoutRect& rootRelat iveBounds, bool& rootRelativeBoundsComputed, | 123 ClipPathHelper(GraphicsContext* context, const DeprecatedPaintLayer& paintLa yer, const LayoutRect& interestRect, LayoutRect& rootRelativeBounds, bool& rootR elativeBoundsComputed, |
124 const LayoutPoint& offsetFromRoot, PaintLayerFlags paintFlags) | 124 const LayoutPoint& offsetFromRoot, PaintLayerFlags paintFlags) |
125 : m_resourceClipper(0), m_paintLayer(paintLayer), m_context(context) | 125 : m_resourceClipper(0), m_paintLayer(paintLayer), m_context(context) |
126 { | 126 { |
127 const ComputedStyle& style = paintLayer.layoutObject()->styleRef(); | 127 const ComputedStyle& style = paintLayer.layoutObject()->styleRef(); |
128 | 128 |
129 // Clip-path, like border radius, must not be applied to the contents of a composited-scrolling container. | 129 // Clip-path, like border radius, must not be applied to the contents of a composited-scrolling container. |
130 // It must, however, still be applied to the mask layer, so that the com positor can properly mask the | 130 // It must, however, still be applied to the mask layer, so that the com positor can properly mask the |
131 // scrolling contents and scrollbars. | 131 // scrolling contents and scrollbars. |
132 if (!paintLayer.layoutObject()->hasClipPath() || (paintLayer.needsCompos itedScrolling() && !(paintFlags & PaintLayerPaintingChildClippingMaskPhase))) | 132 if (!paintLayer.layoutObject()->hasClipPath() || (paintLayer.needsCompos itedScrolling() && !(paintFlags & PaintLayerPaintingChildClippingMaskPhase))) |
133 return; | 133 return; |
134 | 134 |
135 m_clipperState = SVGClipPainter::ClipperNotApplied; | 135 m_clipperState = SVGClipPainter::ClipperNotApplied; |
136 | 136 |
137 ASSERT(style.clipPath()); | 137 ASSERT(style.clipPath()); |
138 if (style.clipPath()->type() == ClipPathOperation::SHAPE) { | 138 if (style.clipPath()->type() == ClipPathOperation::SHAPE) { |
139 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style.cl ipPath()); | 139 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style.cl ipPath()); |
140 if (clipPath->isValid()) { | 140 if (clipPath->isValid()) { |
141 if (!rootRelativeBoundsComputed) { | 141 if (!rootRelativeBoundsComputed) { |
142 rootRelativeBounds = paintLayer.physicalBoundingBoxIncluding ReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 142 rootRelativeBounds = paintLayer.physicalBoundingBoxIncluding ReflectionAndStackingChildren(offsetFromRoot); |
143 rootRelativeBoundsComputed = true; | 143 rootRelativeBoundsComputed = true; |
144 } | 144 } |
145 m_clipPathRecorder.emplace(*context, *paintLayer.layoutObject(), clipPath->path(FloatRect(rootRelativeBounds))); | 145 m_clipPathRecorder.emplace(*context, *paintLayer.layoutObject(), clipPath->path(FloatRect(rootRelativeBounds))); |
146 } | 146 } |
147 } else if (style.clipPath()->type() == ClipPathOperation::REFERENCE) { | 147 } else if (style.clipPath()->type() == ClipPathOperation::REFERENCE) { |
148 ReferenceClipPathOperation* referenceClipPathOperation = toReference ClipPathOperation(style.clipPath()); | 148 ReferenceClipPathOperation* referenceClipPathOperation = toReference ClipPathOperation(style.clipPath()); |
149 Document& document = paintLayer.layoutObject()->document(); | 149 Document& document = paintLayer.layoutObject()->document(); |
150 // FIXME: It doesn't work with forward or external SVG references (h ttps://bugs.webkit.org/show_bug.cgi?id=90405) | 150 // FIXME: It doesn't work with forward or external SVG references (h ttps://bugs.webkit.org/show_bug.cgi?id=90405) |
151 Element* element = document.getElementById(referenceClipPathOperatio n->fragment()); | 151 Element* element = document.getElementById(referenceClipPathOperatio n->fragment()); |
152 if (isSVGClipPathElement(element) && element->layoutObject()) { | 152 if (isSVGClipPathElement(element) && element->layoutObject()) { |
153 if (!rootRelativeBoundsComputed) { | 153 if (!rootRelativeBoundsComputed) { |
154 rootRelativeBounds = paintLayer.physicalBoundingBoxIncluding ReflectionAndStackingChildren(paintingInfo.rootLayer, offsetFromRoot); | 154 rootRelativeBounds = paintLayer.physicalBoundingBoxIncluding ReflectionAndStackingChildren(offsetFromRoot); |
155 rootRelativeBoundsComputed = true; | 155 rootRelativeBoundsComputed = true; |
156 } | 156 } |
157 | 157 |
158 m_resourceClipper = toLayoutSVGResourceClipper(toLayoutSVGResour ceContainer(element->layoutObject())); | 158 m_resourceClipper = toLayoutSVGResourceClipper(toLayoutSVGResour ceContainer(element->layoutObject())); |
159 if (!SVGClipPainter(*m_resourceClipper).prepareEffect(*paintLaye r.layoutObject(), FloatRect(rootRelativeBounds), | 159 if (!SVGClipPainter(*m_resourceClipper).prepareEffect(*paintLaye r.layoutObject(), FloatRect(rootRelativeBounds), |
160 FloatRect(paintingInfo.paintDirtyRect), context, m_clipperSt ate)) { | 160 FloatRect(interestRect), context, m_clipperState)) { |
161 // No need to post-apply the clipper if this failed. | 161 // No need to post-apply the clipper if this failed. |
162 m_resourceClipper = 0; | 162 m_resourceClipper = 0; |
163 } | 163 } |
164 } | 164 } |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
168 ~ClipPathHelper() | 168 ~ClipPathHelper() |
169 { | 169 { |
170 if (m_resourceClipper) | 170 if (m_resourceClipper) |
(...skipping 28 matching lines...) Expand all Loading... | |
199 && ((isPaintingScrollingContent && isPaintingCompositedBackground) | 199 && ((isPaintingScrollingContent && isPaintingCompositedBackground) |
200 || (!isPaintingScrollingContent && isPaintingCompositedForeground)); | 200 || (!isPaintingScrollingContent && isPaintingCompositedForeground)); |
201 bool shouldPaintContent = m_paintLayer.hasVisibleContent() && isSelfPainting Layer && !isPaintingOverlayScrollbars; | 201 bool shouldPaintContent = m_paintLayer.hasVisibleContent() && isSelfPainting Layer && !isPaintingOverlayScrollbars; |
202 | 202 |
203 if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !m_paintLayer.layou tObject()->isLayoutView() && !m_paintLayer.layoutObject()->isDocumentElement()) | 203 if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !m_paintLayer.layou tObject()->isLayoutView() && !m_paintLayer.layoutObject()->isDocumentElement()) |
204 return; | 204 return; |
205 | 205 |
206 // Ensure our lists are up-to-date. | 206 // Ensure our lists are up-to-date. |
207 m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); | 207 m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); |
208 | 208 |
209 LayoutPoint offsetFromRoot; | 209 LayoutPoint offsetFromRoot = toLayoutPoint(paintingInfo.subPixelAccumulation ); |
210 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); | 210 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
211 | 211 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot , DeprecatedPaintLayer::ExcludeScroll); |
212 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking) | |
213 offsetFromRoot.move(m_paintLayer.subpixelAccumulation()); | |
214 else | 212 else |
215 offsetFromRoot.move(paintingInfo.subPixelAccumulation); | 213 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot ); |
216 | 214 |
217 LayoutRect rootRelativeBounds; | 215 LayoutRect rootRelativeBounds; |
218 bool rootRelativeBoundsComputed = false; | 216 bool rootRelativeBoundsComputed = false; |
219 | 217 |
218 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && !context->displayIte mList()->displayItemConstructionIsDisabled()) { | |
219 if (paintingInfo.rootLayer == &m_paintLayer) { | |
220 // A counter scroll needs to be applied in non-rootLayerScrolls mode , | |
pdr.
2015/09/03 06:16:59
Can you add a test for this?
trchen
2015/09/04 06:10:15
I think it is a bit too early. This is only a work
| |
221 // because we are supposed to paint in absolute space. | |
222 // (i.e. Impl-side scrolling would be impossible.) | |
223 // With rootLayerScrolls enabled, we are in the viewport space inste ad. | |
224 AffineTransform counterScroll; | |
225 if (m_paintLayer.layoutObject()->isLayoutView()) { | |
226 Settings* settings = m_paintLayer.layoutObject()->document().set tings(); | |
227 if (settings && settings->rootLayerScrolls()) { | |
228 IntSize scrollOffset = static_cast<LayoutView*>(m_paintLayer .layoutObject())->frameView()->scrollOffset(); | |
229 counterScroll.translate(scrollOffset.width(), scrollOffset.h eight()); | |
230 } | |
231 } | |
232 TransformRecorder frameScrollWorkaround(*context, *m_paintLayer.layo utObject(), counterScroll); | |
233 | |
234 context->displayItemList()->createAndAppend<FixedPositionContainerDi splayItem>(*m_paintLayer.layoutObject()); | |
235 } | |
236 } | |
237 | |
220 // These helpers output clip and compositing operations using a RAII pattern . Stack-allocated-varibles are destructed in the reverse order of construction, | 238 // These helpers output clip and compositing operations using a RAII pattern . Stack-allocated-varibles are destructed in the reverse order of construction, |
221 // so they are nested properly. | 239 // so they are nested properly. |
222 ClipPathHelper clipPathHelper(context, m_paintLayer, paintingInfo, rootRelat iveBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags); | 240 ClipPathHelper clipPathHelper(context, m_paintLayer, paintingInfo.paintDirty Rect, rootRelativeBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags ); |
223 | 241 |
224 Optional<CompositingRecorder> compositingRecorder; | 242 Optional<CompositingRecorder> compositingRecorder; |
225 // Blending operations must be performed only with the nearest ancestor stac king context. | 243 // Blending operations must be performed only with the nearest ancestor stac king context. |
226 // Note that there is no need to composite if we're painting the root. | 244 // Note that there is no need to composite if we're painting the root. |
227 // FIXME: this should be unified further into DeprecatedPaintLayer::paintsWi thTransparency(). | 245 // FIXME: this should be unified further into DeprecatedPaintLayer::paintsWi thTransparency(). |
228 bool shouldCompositeForBlendMode = (!m_paintLayer.layoutObject()->isDocument Element() || m_paintLayer.layoutObject()->isSVGRoot()) && m_paintLayer.stackingN ode()->isStackingContext() && m_paintLayer.hasNonIsolatedDescendantWithBlendMode (); | 246 bool shouldCompositeForBlendMode = (!m_paintLayer.layoutObject()->isDocument Element() || m_paintLayer.layoutObject()->isSVGRoot()) && m_paintLayer.stackingN ode()->isStackingContext() && m_paintLayer.hasNonIsolatedDescendantWithBlendMode (); |
229 if (shouldCompositeForBlendMode || m_paintLayer.paintsWithTransparency(paint ingInfo.globalPaintFlags())) { | 247 if (shouldCompositeForBlendMode || m_paintLayer.paintsWithTransparency(paint ingInfo.globalPaintFlags())) { |
230 FloatRect compositingBounds = FloatRect(m_paintLayer.paintingExtent(pain tingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.globalPaintFlags() )); | 248 FloatRect compositingBounds = FloatRect(m_paintLayer.paintingExtent(pain tingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.globalPaintFlags() )); |
231 compositingRecorder.emplace(*context, *m_paintLayer.layoutObject(), | 249 compositingRecorder.emplace(*context, *m_paintLayer.layoutObject(), |
232 WebCoreCompositeToSkiaComposite(CompositeSourceOver, m_paintLayer.la youtObject()->style()->blendMode()), | 250 WebCoreCompositeToSkiaComposite(CompositeSourceOver, m_paintLayer.la youtObject()->style()->blendMode()), |
233 m_paintLayer.layoutObject()->opacity(), &compositingBounds); | 251 m_paintLayer.layoutObject()->opacity(), &compositingBounds); |
234 } | 252 } |
235 | 253 |
236 DeprecatedPaintLayerPaintingInfo localPaintingInfo(paintingInfo); | |
237 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking) | |
238 localPaintingInfo.subPixelAccumulation = m_paintLayer.subpixelAccumulati on(); | |
239 | |
240 DeprecatedPaintLayerFragments layerFragments; | 254 DeprecatedPaintLayerFragments layerFragments; |
241 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { | 255 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { |
242 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment. | 256 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment. |
243 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects ) ? UncachedClipRects : PaintingClipRects; | 257 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects ) ? UncachedClipRects : PaintingClipRects; |
244 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowCli p(paintFlags, m_paintLayer.layoutObject()); | 258 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowCli p(paintFlags, m_paintLayer.layoutObject()); |
245 if (fragmentPolicy == ForceSingleFragment) | 259 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
246 m_paintLayer.appendSingleFragmentIgnoringPagination(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, Ignore OverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.su bPixelAccumulation); | 260 // TODO(trchen): Need to handle layer fragmentation. |
247 else | 261 DeprecatedPaintLayerFragment fragment; |
248 m_paintLayer.collectFragments(layerFragments, localPaintingInfo.root Layer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation); | 262 fragment.layerBounds = LayoutRect(offsetFromRoot, LayoutSize(m_paint Layer.size())); |
263 fragment.backgroundRect = LayoutRect::infiniteRect(); | |
264 fragment.foregroundRect = LayoutRect::infiniteRect(); | |
265 fragment.outlineRect = LayoutRect::infiniteRect(); | |
266 layerFragments.append(fragment); | |
267 } else if (fragmentPolicy == ForceSingleFragment) { | |
268 m_paintLayer.appendSingleFragmentIgnoringPagination(layerFragments, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScr ollbarSize, respectOverflowClip, &offsetFromRoot, paintingInfo.subPixelAccumulat ion); | |
269 } else { | |
270 m_paintLayer.collectFragments(layerFragments, paintingInfo.rootLayer , paintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOve rflowClip, &offsetFromRoot, paintingInfo.subPixelAccumulation); | |
271 } | |
272 | |
249 if (shouldPaintContent) | 273 if (shouldPaintContent) |
250 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra gments, localPaintingInfo, paintFlags, offsetFromRoot); | 274 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra gments, paintingInfo, paintFlags, offsetFromRoot); |
251 } | 275 } |
252 | 276 |
253 bool selectionOnly = localPaintingInfo.globalPaintFlags() & GlobalPaintSelec tionOnly; | 277 bool selectionOnly = paintingInfo.globalPaintFlags() & GlobalPaintSelectionO nly; |
254 // If this layer's layoutObject is a child of the paintingRoot, we paint unc onditionally, which | 278 // If this layer's layoutObject is a child of the paintingRoot, we paint unc onditionally, which |
255 // is done by passing a nil paintingRoot down to our layoutObject (as if no paintingRoot was ever set). | 279 // is done by passing a nil paintingRoot down to our layoutObject (as if no paintingRoot was ever set). |
256 // Else, our layout tree may or may not contain the painting root, so we pas s that root along | 280 // Else, our layout tree may or may not contain the painting root, so we pas s that root along |
257 // so it will be tested against as we descend through the layoutObjects. | 281 // so it will be tested against as we descend through the layoutObjects. |
258 LayoutObject* paintingRootForLayoutObject = 0; | 282 LayoutObject* paintingRootForLayoutObject = 0; |
259 if (localPaintingInfo.paintingRoot && !m_paintLayer.layoutObject()->isDescen dantOf(localPaintingInfo.paintingRoot)) | 283 if (paintingInfo.paintingRoot && !m_paintLayer.layoutObject()->isDescendantO f(paintingInfo.paintingRoot)) |
260 paintingRootForLayoutObject = localPaintingInfo.paintingRoot; | 284 paintingRootForLayoutObject = paintingInfo.paintingRoot; |
261 | 285 |
262 { // Begin block for the lifetime of any filter. | 286 { // Begin block for the lifetime of any filter. |
263 FilterPainter filterPainter(m_paintLayer, context, offsetFromRoot, layer Fragments.isEmpty() ? ClipRect() : layerFragments[0].backgroundRect, localPainti ngInfo, paintFlags, | 287 // FilterRecorder may mutate paintingInfo. |
pdr.
2015/09/03 06:16:59
FilterRecorder -> FilterPainter, but I agree about
trchen
2015/09/04 06:10:14
Revert done.
| |
288 DeprecatedPaintLayerPaintingInfo localPaintingInfo(paintingInfo); | |
289 localPaintingInfo.clipToDirtyRect = true; | |
290 ClipRect compositingBound; | |
291 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | |
trchen
2015/09/02 22:55:37
This change is unnecessary at this moment. Probabl
| |
292 // Similar to transparency clip above, for SPv2 the compositing boun d is only | |
293 // known since layerization and impl-side animation has been applied . | |
294 compositingBound = localPaintingInfo.paintDirtyRect; | |
295 } else if (!layerFragments.isEmpty()) { | |
296 // TODO(trchen): Using layerFragments[0].backgroundRect as compositi ng bound is | |
297 // incorrect. Using the union of the fragment clip rects could be a workaround | |
298 // but is still wrong in operation order. Conceptually it should be equivalent | |
299 // as painting the filtered stacking context as a whole, then cut th e results into | |
300 // fragments for pasting. | |
301 compositingBound = layerFragments[0].backgroundRect; | |
302 } | |
303 FilterPainter filterPainter(m_paintLayer, context, offsetFromRoot, compo sitingBound, localPaintingInfo, paintFlags, | |
264 rootRelativeBounds, rootRelativeBoundsComputed); | 304 rootRelativeBounds, rootRelativeBoundsComputed); |
265 | 305 |
266 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPai ntContent && !selectionOnly; | 306 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPai ntContent && !selectionOnly; |
267 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintin gOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackgr ound); | 307 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintin gOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackgr ound); |
268 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPa intContent; | 308 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPa intContent; |
269 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForegr ound; | 309 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForegr ound; |
270 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars; | 310 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars; |
271 | 311 |
272 if (shouldPaintBackground) { | 312 if (shouldPaintBackground) { |
273 paintBackgroundForFragments(layerFragments, context, paintingInfo.pa intDirtyRect, | 313 paintBackgroundForFragments(layerFragments, context, localPaintingIn fo.paintDirtyRect, |
274 localPaintingInfo, paintingRootForLayoutObject, paintFlags); | 314 localPaintingInfo, paintingRootForLayoutObject, paintFlags); |
275 } | 315 } |
276 | 316 |
277 if (shouldPaintNegZOrderList) | 317 if (shouldPaintNegZOrderList) |
278 paintChildren(NegativeZOrderChildren, context, paintingInfo, paintFl ags); | 318 paintChildren(NegativeZOrderChildren, context, localPaintingInfo, pa intFlags); |
279 | 319 |
280 if (shouldPaintOwnContents) { | 320 if (shouldPaintOwnContents) { |
281 paintForegroundForFragments(layerFragments, context, paintingInfo.pa intDirtyRect, | 321 paintForegroundForFragments(layerFragments, context, localPaintingIn fo.paintDirtyRect, |
282 localPaintingInfo, paintingRootForLayoutObject, selectionOnly, p aintFlags); | 322 localPaintingInfo, paintingRootForLayoutObject, selectionOnly, p aintFlags); |
283 } | 323 } |
284 | 324 |
285 if (shouldPaintOutline) | 325 if (shouldPaintOutline) |
286 paintOutlineForFragments(layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags); | 326 paintOutlineForFragments(layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags); |
287 | 327 |
288 if (shouldPaintNormalFlowAndPosZOrderLists) | 328 if (shouldPaintNormalFlowAndPosZOrderLists) |
289 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, paintingInfo, paintFlags); | 329 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, localPaintingInfo, paintFlags); |
290 | 330 |
291 if (shouldPaintOverlayScrollbars) | 331 if (shouldPaintOverlayScrollbars) |
292 paintOverflowControlsForFragments(layerFragments, context, localPain tingInfo, paintFlags); | 332 paintOverflowControlsForFragments(layerFragments, context, localPain tingInfo, paintFlags); |
293 } // FilterPainter block | 333 } // FilterPainter block |
294 | 334 |
295 bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && m_paintLayer.layoutObject()->hasMask() && !selectionOn ly; | 335 bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && m_paintLayer.layoutObject()->hasMask() && !selectionOn ly; |
296 bool shouldPaintClippingMask = (paintFlags & PaintLayerPaintingChildClipping MaskPhase) && shouldPaintContent && !selectionOnly; | 336 bool shouldPaintClippingMask = (paintFlags & PaintLayerPaintingChildClipping MaskPhase) && shouldPaintContent && !selectionOnly; |
297 | 337 |
298 if (shouldPaintMask) | 338 if (shouldPaintMask) |
299 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForLayoutObject, paintFlags); | 339 paintMaskForFragments(layerFragments, context, paintingInfo, paintingRoo tForLayoutObject, paintFlags); |
300 if (shouldPaintClippingMask) { | 340 if (shouldPaintClippingMask) { |
301 // Paint the border radius mask for the fragments. | 341 // Paint the border radius mask for the fragments. |
302 paintChildClippingMaskForFragments(layerFragments, context, localPaintin gInfo, paintingRootForLayoutObject, paintFlags); | 342 paintChildClippingMaskForFragments(layerFragments, context, paintingInfo , paintingRootForLayoutObject, paintFlags); |
303 } | 343 } |
304 } | 344 } |
305 | 345 |
306 bool DeprecatedPaintLayerPainter::needsToClip(const DeprecatedPaintLayerPainting Info& localPaintingInfo, const ClipRect& clipRect) | 346 bool DeprecatedPaintLayerPainter::needsToClip(const DeprecatedPaintLayerPainting Info& localPaintingInfo, const ClipRect& clipRect) |
307 { | 347 { |
348 // With SPv2 a layer clips its descendants so a layer never clips itself. | |
349 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
350 return false; | |
308 return clipRect.rect() != localPaintingInfo.paintDirtyRect || clipRect.hasRa dius(); | 351 return clipRect.rect() != localPaintingInfo.paintDirtyRect || clipRect.hasRa dius(); |
309 } | 352 } |
310 | 353 |
311 bool DeprecatedPaintLayerPainter::atLeastOneFragmentIntersectsDamageRect(Depreca tedPaintLayerFragments& fragments, const DeprecatedPaintLayerPaintingInfo& local PaintingInfo, PaintLayerFlags localPaintFlags, const LayoutPoint& offsetFromRoot ) | 354 bool DeprecatedPaintLayerPainter::atLeastOneFragmentIntersectsDamageRect(Depreca tedPaintLayerFragments& fragments, const DeprecatedPaintLayerPaintingInfo& local PaintingInfo, PaintLayerFlags localPaintFlags, const LayoutPoint& offsetFromRoot ) |
312 { | 355 { |
313 if (m_paintLayer.enclosingPaginationLayer()) | 356 if (m_paintLayer.enclosingPaginationLayer()) |
314 return true; // The fragments created have already been found to interse ct with the damage rect. | 357 return true; // The fragments created have already been found to interse ct with the damage rect. |
315 | 358 |
316 if (&m_paintLayer == localPaintingInfo.rootLayer && (localPaintFlags & Paint LayerPaintingOverflowContents)) | 359 if (&m_paintLayer == localPaintingInfo.rootLayer && (localPaintFlags & Paint LayerPaintingOverflowContents)) |
317 return true; | 360 return true; |
318 | 361 |
319 for (DeprecatedPaintLayerFragment& fragment: fragments) { | 362 for (DeprecatedPaintLayerFragment& fragment: fragments) { |
320 LayoutPoint newOffsetFromRoot = offsetFromRoot + fragment.paginationOffs et; | 363 LayoutPoint newOffsetFromRoot = offsetFromRoot + fragment.paginationOffs et; |
321 // Note that this really only works reliably on the first fragment. If t he layer has visible | 364 // Note that this really only works reliably on the first fragment. If t he layer has visible |
322 // overflow and a subsequent fragment doesn't intersect with the border box of the layer | 365 // overflow and a subsequent fragment doesn't intersect with the border box of the layer |
323 // (i.e. only contains an overflow portion of the layer), intersection w ill fail. The reason | 366 // (i.e. only contains an overflow portion of the layer), intersection w ill fail. The reason |
324 // for this is that fragment.layerBounds is set to the border box, not t he bounding box, of | 367 // for this is that fragment.layerBounds is set to the border box, not t he bounding box, of |
325 // the layer. | 368 // the layer. |
326 if (m_paintLayer.intersectsDamageRect(fragment.layerBounds, fragment.bac kgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFromRoot)) | 369 if (m_paintLayer.intersectsDamageRect(fragment.layerBounds, fragment.bac kgroundRect.rect(), nullptr, &newOffsetFromRoot)) |
327 return true; | 370 return true; |
328 } | 371 } |
329 return false; | 372 return false; |
330 } | 373 } |
331 | 374 |
332 void DeprecatedPaintLayerPainter::paintLayerWithTransform(GraphicsContext* conte xt, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintF lags) | 375 void DeprecatedPaintLayerPainter::paintLayerWithTransform(GraphicsContext* conte xt, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintF lags) |
333 { | 376 { |
334 TransformationMatrix layerTransform = m_paintLayer.renderableTransform(paint ingInfo.globalPaintFlags()); | 377 TransformationMatrix layerTransform = m_paintLayer.renderableTransform(paint ingInfo.globalPaintFlags()); |
335 // If the transform can't be inverted, then don't paint anything. | 378 // If the transform can't be inverted, then don't paint anything. |
336 if (!layerTransform.isInvertible()) | 379 if (!layerTransform.isInvertible()) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 | 457 |
415 void DeprecatedPaintLayerPainter::paintChildren(unsigned childrenToVisit, Graphi csContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintL ayerFlags paintFlags) | 458 void DeprecatedPaintLayerPainter::paintChildren(unsigned childrenToVisit, Graphi csContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintL ayerFlags paintFlags) |
416 { | 459 { |
417 if (!m_paintLayer.hasSelfPaintingLayerDescendant()) | 460 if (!m_paintLayer.hasSelfPaintingLayerDescendant()) |
418 return; | 461 return; |
419 | 462 |
420 #if ENABLE(ASSERT) | 463 #if ENABLE(ASSERT) |
421 LayerListMutationDetector mutationChecker(m_paintLayer.stackingNode()); | 464 LayerListMutationDetector mutationChecker(m_paintLayer.stackingNode()); |
422 #endif | 465 #endif |
423 | 466 |
467 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | |
468 paintChildrenWithFullScrollClipChain(childrenToVisit, context, paintingI nfo, paintFlags); | |
469 return; | |
470 } | |
471 | |
424 IntSize scrollOffsetAccumulation = paintingInfo.scrollOffsetAccumulation; | 472 IntSize scrollOffsetAccumulation = paintingInfo.scrollOffsetAccumulation; |
425 if (m_paintLayer.layoutObject()->hasOverflowClip()) | 473 if (m_paintLayer.layoutObject()->hasOverflowClip()) |
426 scrollOffsetAccumulation += m_paintLayer.layoutBox()->scrolledContentOff set(); | 474 scrollOffsetAccumulation += m_paintLayer.layoutBox()->scrolledContentOff set(); |
427 | 475 |
428 DeprecatedPaintLayerStackingNodeIterator iterator(*m_paintLayer.stackingNode (), childrenToVisit); | 476 DeprecatedPaintLayerStackingNodeIterator iterator(*m_paintLayer.stackingNode (), childrenToVisit); |
429 while (DeprecatedPaintLayerStackingNode* child = iterator.next()) { | 477 while (DeprecatedPaintLayerStackingNode* child = iterator.next()) { |
430 DeprecatedPaintLayerPainter childPainter(*child->layer()); | 478 DeprecatedPaintLayerPainter childPainter(*child->layer()); |
431 // If this Layer should paint into its own backing or a grouped backing, that will be done via CompositedDeprecatedPaintLayerMapping::paintContents() | 479 // If this Layer should paint into its own backing or a grouped backing, that will be done via CompositedDeprecatedPaintLayerMapping::paintContents() |
432 // and CompositedDeprecatedPaintLayerMapping::doPaintTask(). | 480 // and CompositedDeprecatedPaintLayerMapping::doPaintTask(). |
433 if (!childPainter.shouldPaintLayerInSoftwareMode(paintingInfo.globalPain tFlags(), paintFlags)) | 481 if (!childPainter.shouldPaintLayerInSoftwareMode(paintingInfo.globalPain tFlags(), paintFlags)) |
434 continue; | 482 continue; |
435 | 483 |
436 DeprecatedPaintLayerPaintingInfo childPaintingInfo = paintingInfo; | 484 DeprecatedPaintLayerPaintingInfo childPaintingInfo = paintingInfo; |
437 childPaintingInfo.scrollOffsetAccumulation = scrollOffsetAccumulation; | 485 childPaintingInfo.scrollOffsetAccumulation = scrollOffsetAccumulation; |
438 // Rare case: accumulate scroll offset of non-stacking-context ancestors up to m_paintLayer. | 486 // Rare case: accumulate scroll offset of non-stacking-context ancestors up to m_paintLayer. |
439 for (DeprecatedPaintLayer* parentLayer = child->layer()->parent(); paren tLayer != &m_paintLayer; parentLayer = parentLayer->parent()) { | 487 for (DeprecatedPaintLayer* parentLayer = child->layer()->parent(); paren tLayer != &m_paintLayer; parentLayer = parentLayer->parent()) { |
440 if (parentLayer->layoutObject()->hasOverflowClip()) | 488 if (parentLayer->layoutObject()->hasOverflowClip()) |
441 childPaintingInfo.scrollOffsetAccumulation += parentLayer->layou tBox()->scrolledContentOffset(); | 489 childPaintingInfo.scrollOffsetAccumulation += parentLayer->layou tBox()->scrolledContentOffset(); |
442 } | 490 } |
443 | 491 |
444 childPainter.paintLayer(context, childPaintingInfo, paintFlags); | 492 childPainter.paintLayer(context, childPaintingInfo, paintFlags); |
445 } | 493 } |
446 } | 494 } |
447 | 495 |
496 static void recursivelyScrollAndPaintChildLayer(Vector<DeprecatedPaintLayer*>& c lippingAncestors, DeprecatedPaintLayer& child, GraphicsContext& context, const D eprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | |
497 { | |
pdr.
2015/09/03 06:16:59
ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enab
trchen
2015/09/04 06:10:15
Done.
| |
498 if (clippingAncestors.isEmpty()) { | |
499 DeprecatedPaintLayerPainter(child).paintLayer(&context, paintingInfo, pa intFlags); | |
500 return; | |
501 } | |
502 DeprecatedPaintLayer* layer = clippingAncestors.last(); | |
503 clippingAncestors.removeLast(); | |
504 | |
505 ASSERT(layer->layoutObject()->hasOverflowClip() && layer->layoutObject()->is Box()); | |
506 LayoutPoint paintOffset = toLayoutPoint(paintingInfo.subPixelAccumulation); | |
507 // TODO(trchen): Hey this is slow. We should be able to calculate this on tr aversal. | |
508 layer->convertToLayerCoords(paintingInfo.rootLayer, paintOffset, DeprecatedP aintLayer::ExcludeScroll); | |
509 LayerClipRecorder clipRecorder(context, *layer->layoutBox(), paintOffset); | |
510 | |
511 IntSize scrollOffset = layer->layoutBox()->scrolledContentOffset(); | |
pdr.
2015/09/03 06:16:59
Don't we need to emit a scroll recorder even if th
trchen
2015/09/04 06:10:15
Isn't it the first clause on line 513?
| |
512 Optional<ScrollRecorder> scrollRecorder; | |
513 if (layer->scrollsOverflow() || !scrollOffset.isZero()) | |
514 scrollRecorder.emplace(context, *layer->layoutObject(), PaintPhaseBlockB ackground, scrollOffset); | |
515 recursivelyScrollAndPaintChildLayer(clippingAncestors, child, context, paint ingInfo, paintFlags); | |
516 } | |
517 | |
518 // TODO(trchen): Measure performance of this and implement display item de-dupin g if needed. | |
519 // For the pessimistic case this function will generate O(n^2) of clip/scroll pa irs, for example: | |
520 // <div style="overflow:scroll;"> * repeat 100 times | |
521 // <div style="position:relative;"></div> * repeat 100 times | |
522 // We will need to generate 100 clip/scroll pairs for each of the in-flow positi oned children. | |
523 void DeprecatedPaintLayerPainter::paintChildrenWithFullScrollClipChain(unsigned childrenToVisit, GraphicsContext* context, const DeprecatedPaintLayerPaintingInf o& paintingInfo, PaintLayerFlags paintFlags) | |
524 { | |
525 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
526 | |
527 DeprecatedPaintLayerStackingNodeIterator iterator(*m_paintLayer.stackingNode (), childrenToVisit); | |
528 while (DeprecatedPaintLayerStackingNode* childNode = iterator.next()) { | |
529 DeprecatedPaintLayer* child = childNode->layer(); | |
530 EPosition childPosition = child->layoutObject()->style()->position(); | |
531 if (childPosition == FixedPosition) { | |
532 ASSERT(paintingInfo.rootLayer == child->enclosingPositionedAncestor( )); | |
533 // TODO(trchen): Handle the insanity with reflection + fixed positio n. | |
534 LayerFixedPositionRecorder fixedPositionRecorder(*context, *child->l ayoutObject(), *paintingInfo.rootLayer->layoutObject()); | |
535 DeprecatedPaintLayerPainter(*child).paintLayer(context, paintingInfo , paintFlags); | |
536 continue; | |
537 } | |
538 | |
539 Vector<DeprecatedPaintLayer*> clippingAncestors; | |
540 DeprecatedPaintLayer* currentLayer = child; | |
541 while (currentLayer && currentLayer != &m_paintLayer) { | |
542 EPosition position = currentLayer->layoutObject()->style()->position (); | |
543 ASSERT(position != FixedPosition); | |
544 | |
545 DeprecatedPaintLayer* container = nullptr; | |
546 if (position == AbsolutePosition) { | |
547 bool ranPastThisLayer; | |
548 container = currentLayer->enclosingPositionedAncestor(&m_paintLa yer, &ranPastThisLayer); | |
549 if (ranPastThisLayer) | |
550 break; | |
551 } else { | |
552 container = currentLayer->parent(); | |
553 } | |
554 if (!container) | |
555 break; | |
556 | |
557 if (container->layoutObject()->hasOverflowClip()) | |
558 clippingAncestors.append(container); | |
559 | |
560 currentLayer = container; | |
561 } | |
562 | |
563 recursivelyScrollAndPaintChildLayer(clippingAncestors, *child, *context, paintingInfo, paintFlags); | |
564 } | |
565 } | |
566 | |
448 // FIXME: inline this. | 567 // FIXME: inline this. |
449 static bool paintForFixedRootBackground(const DeprecatedPaintLayer* layer, Paint LayerFlags paintFlags) | 568 static bool paintForFixedRootBackground(const DeprecatedPaintLayer* layer, Paint LayerFlags paintFlags) |
450 { | 569 { |
451 return layer->layoutObject()->isDocumentElement() && (paintFlags & PaintLaye rPaintingRootBackgroundOnly); | 570 return layer->layoutObject()->isDocumentElement() && (paintFlags & PaintLaye rPaintingRootBackgroundOnly); |
452 } | 571 } |
453 | 572 |
454 bool DeprecatedPaintLayerPainter::shouldPaintLayerInSoftwareMode(const GlobalPai ntFlags globalPaintFlags, PaintLayerFlags paintFlags) | 573 bool DeprecatedPaintLayerPainter::shouldPaintLayerInSoftwareMode(const GlobalPai ntFlags globalPaintFlags, PaintLayerFlags paintFlags) |
455 { | 574 { |
456 DisableCompositingQueryAsserts disabler; | 575 DisableCompositingQueryAsserts disabler; |
457 | 576 |
(...skipping 17 matching lines...) Expand all Loading... | |
475 clipRecorder.emplace(*context, *m_paintLayer.layoutObject(), Display Item::ClipLayerOverflowControls, fragment.backgroundRect, &localPaintingInfo, fr agment.paginationOffset, paintFlags); | 594 clipRecorder.emplace(*context, *m_paintLayer.layoutObject(), Display Item::ClipLayerOverflowControls, fragment.backgroundRect, &localPaintingInfo, fr agment.paginationOffset, paintFlags); |
476 if (DeprecatedPaintLayerScrollableArea* scrollableArea = m_paintLayer.sc rollableArea()) | 595 if (DeprecatedPaintLayerScrollableArea* scrollableArea = m_paintLayer.sc rollableArea()) |
477 ScrollableAreaPainter(*scrollableArea).paintOverflowControls(context , roundedIntPoint(toPoint(fragment.layerBounds.location() - m_paintLayer.layoutB oxLocation())), pixelSnappedIntRect(fragment.backgroundRect.rect()), true); | 596 ScrollableAreaPainter(*scrollableArea).paintOverflowControls(context , roundedIntPoint(toPoint(fragment.layerBounds.location() - m_paintLayer.layoutB oxLocation())), pixelSnappedIntRect(fragment.backgroundRect.rect()), true); |
478 } | 597 } |
479 } | 598 } |
480 | 599 |
481 void DeprecatedPaintLayerPainter::paintFragmentWithPhase(PaintPhase phase, const DeprecatedPaintLayerFragment& fragment, GraphicsContext* context, const ClipRec t& clipRect, const DeprecatedPaintLayerPaintingInfo& paintingInfo, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags, ClipState clipState) | 600 void DeprecatedPaintLayerPainter::paintFragmentWithPhase(PaintPhase phase, const DeprecatedPaintLayerFragment& fragment, GraphicsContext* context, const ClipRec t& clipRect, const DeprecatedPaintLayerPaintingInfo& paintingInfo, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags, ClipState clipState) |
482 { | 601 { |
483 ASSERT(m_paintLayer.isSelfPaintingLayer()); | 602 ASSERT(m_paintLayer.isSelfPaintingLayer()); |
484 | 603 |
604 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | |
605 PaintInfo paintInfo(context, enclosingIntRect(paintingInfo.paintDirtyRec t), phase, paintingInfo.globalPaintFlags(), paintFlags, paintingRootForLayoutObj ect, paintingInfo.rootLayer->layoutObject()); | |
606 LayoutPoint paintOffset = toPoint(fragment.layerBounds.location() - m_pa intLayer.layoutBoxLocation()); | |
607 m_paintLayer.layoutObject()->paint(paintInfo, paintOffset); | |
608 return; | |
609 } | |
610 | |
485 Optional<LayerClipRecorder> clipRecorder; | 611 Optional<LayerClipRecorder> clipRecorder; |
486 if (clipState != HasClipped && paintingInfo.clipToDirtyRect && needsToClip(p aintingInfo, clipRect)) { | 612 if (clipState != HasClipped && paintingInfo.clipToDirtyRect && needsToClip(p aintingInfo, clipRect)) { |
487 DisplayItem::Type clipType = DisplayItem::paintPhaseToClipLayerFragmentT ype(phase); | 613 DisplayItem::Type clipType = DisplayItem::paintPhaseToClipLayerFragmentT ype(phase); |
488 LayerClipRecorder::BorderRadiusClippingRule clippingRule; | 614 LayerClipRecorder::BorderRadiusClippingRule clippingRule; |
489 switch (phase) { | 615 switch (phase) { |
490 case PaintPhaseBlockBackground: // Background painting will handle clipp ing to self. | 616 case PaintPhaseBlockBackground: // Background painting will handle clipp ing to self. |
491 case PaintPhaseSelfOutline: | 617 case PaintPhaseSelfOutline: |
492 case PaintPhaseMask: // Mask painting will handle clipping to self. | 618 case PaintPhaseMask: // Mask painting will handle clipping to self. |
493 clippingRule = LayerClipRecorder::DoNotIncludeSelfForBorderRadius; | 619 clippingRule = LayerClipRecorder::DoNotIncludeSelfForBorderRadius; |
494 break; | 620 break; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
610 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 736 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
611 return; | 737 return; |
612 | 738 |
613 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); | 739 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); |
614 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 740 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
615 | 741 |
616 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 742 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
617 } | 743 } |
618 | 744 |
619 } // namespace blink | 745 } // namespace blink |
OLD | NEW |