Chromium Code Reviews| 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" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot); | 48 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot); |
| 49 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags)) | 49 if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags)) |
| 50 paintLayer(context, paintingInfo, paintFlags); | 50 paintLayer(context, paintingInfo, paintFlags); |
| 51 } | 51 } |
| 52 | 52 |
| 53 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint Flags, const LayoutObject* layoutObject) | 53 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint Flags, const LayoutObject* layoutObject) |
| 54 { | 54 { |
| 55 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO verflowClip : RespectOverflowClip; | 55 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai ntLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreO verflowClip : RespectOverflowClip; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void DeprecatedPaintLayerPainter::paintLayer(GraphicsContext* context, const Dep recatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 58 DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintLayer (GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
| 59 { | |
| 60 PaintResult result = paintLayerInternal(context, paintingInfo, paintFlags); | |
| 61 m_paintLayer.clearNeedsRepaint(); | |
| 62 return result; | |
| 63 } | |
| 64 | |
| 65 DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintLayer Internal(GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& paint ingInfo, PaintLayerFlags paintFlags) | |
| 59 { | 66 { |
| 60 // https://code.google.com/p/chromium/issues/detail?id=343772 | 67 // https://code.google.com/p/chromium/issues/detail?id=343772 |
| 61 DisableCompositingQueryAsserts disabler; | 68 DisableCompositingQueryAsserts disabler; |
| 62 | 69 |
| 63 if (m_paintLayer.compositingState() != NotComposited) { | 70 if (m_paintLayer.compositingState() != NotComposited) { |
| 64 if (paintingInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayer s) { | 71 if (paintingInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayer s) { |
| 65 // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? Th at's for printing and drag-image. | 72 // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? Th at's for printing and drag-image. |
| 66 // FIXME: why isn't the code here global, as opposed to being set on each paintLayer() call? | 73 // FIXME: why isn't the code here global, as opposed to being set on each paintLayer() call? |
| 67 paintFlags |= PaintLayerUncachedClipRects; | 74 paintFlags |= PaintLayerUncachedClipRects; |
| 68 } | 75 } |
| 69 } | 76 } |
| 70 | 77 |
| 71 // Non self-painting leaf layers don't need to be painted as their layoutObj ect() should properly paint itself. | 78 // Non self-painting leaf layers don't need to be painted as their layoutObj ect() should properly paint itself. |
| 72 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye rDescendant()) { | 79 if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLaye rDescendant()) { |
| 73 ASSERT(!m_paintLayer.needsRepaint()); | 80 ASSERT(!m_paintLayer.needsRepaint()); |
| 74 return; | 81 return FullyPainted; |
| 75 } | 82 } |
| 76 | 83 |
| 77 bool needsRepaint = m_paintLayer.needsRepaint(); | |
| 78 m_paintLayer.clearNeedsRepaint(); | |
| 79 | |
| 80 if (shouldSuppressPaintingLayer(&m_paintLayer)) | 84 if (shouldSuppressPaintingLayer(&m_paintLayer)) |
| 81 return; | 85 return FullyPainted; |
| 82 | 86 |
| 83 // If this layer is totally invisible then there is nothing to paint. | 87 // If this layer is totally invisible then there is nothing to paint. |
| 84 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()- >hasBackdropFilter()) | 88 if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()- >hasBackdropFilter()) |
| 85 return; | 89 return FullyPainted; |
| 86 | |
| 87 if (!needsRepaint && SubsequenceRecorder::useCachedSubsequenceIfPossible(*co ntext, m_paintLayer)) | |
| 88 return; | |
| 89 SubsequenceRecorder subsequenceRecorder(*context, m_paintLayer); | |
| 90 | 90 |
| 91 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) | 91 if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) |
| 92 paintFlags |= PaintLayerHaveTransparency; | 92 paintFlags |= PaintLayerHaveTransparency; |
| 93 | 93 |
| 94 LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.lay outObject()); | 94 LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.lay outObject()); |
| 95 | 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 return paintLayerWithTransform(context, paintingInfo, paintFlags); |
| 99 return; | |
| 100 } | |
| 101 | 99 |
| 102 paintLayerContentsAndReflection(context, paintingInfo, paintFlags); | 100 return paintLayerContentsAndReflection(context, paintingInfo, paintFlags); |
| 103 } | 101 } |
| 104 | 102 |
| 105 void DeprecatedPaintLayerPainter::paintLayerContentsAndReflection(GraphicsContex t* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlag s paintFlags, FragmentPolicy fragmentPolicy) | 103 DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintLayer ContentsAndReflection(GraphicsContext* context, const DeprecatedPaintLayerPainti ngInfo& paintingInfo, PaintLayerFlags paintFlags, FragmentPolicy fragmentPolicy) |
| 106 { | 104 { |
| 107 ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLay erDescendant()); | 105 ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLay erDescendant()); |
| 108 | 106 |
| 109 PaintLayerFlags localPaintFlags = paintFlags & ~(PaintLayerAppliedTransform) ; | 107 PaintLayerFlags localPaintFlags = paintFlags & ~(PaintLayerAppliedTransform) ; |
| 110 | 108 |
| 109 PaintResult result = FullyPainted; | |
| 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 result = MaybeNotFullyPainted; | |
|
chrishtr
2015/09/10 16:48:26
Why always MaybeNotFullyPainted?
Xianzhu
2015/09/10 17:04:31
- We don't cache reflection drawings;
- If we did,
| |
| 115 } | 116 } |
| 116 | 117 |
| 117 localPaintFlags |= PaintLayerPaintingCompositingAllPhases; | 118 localPaintFlags |= PaintLayerPaintingCompositingAllPhases; |
| 118 paintLayerContents(context, paintingInfo, localPaintFlags, fragmentPolicy); | 119 if (paintLayerContents(context, paintingInfo, localPaintFlags, fragmentPolic y) == MaybeNotFullyPainted) |
| 120 result = MaybeNotFullyPainted; | |
| 121 | |
| 122 return result; | |
| 119 } | 123 } |
| 120 | 124 |
| 121 class ClipPathHelper { | 125 class ClipPathHelper { |
| 122 public: | 126 public: |
| 123 ClipPathHelper(GraphicsContext* context, const DeprecatedPaintLayer& paintLa yer, DeprecatedPaintLayerPaintingInfo& paintingInfo, LayoutRect& rootRelativeBou nds, bool& rootRelativeBoundsComputed, | 127 ClipPathHelper(GraphicsContext* context, const DeprecatedPaintLayer& paintLa yer, DeprecatedPaintLayerPaintingInfo& paintingInfo, LayoutRect& rootRelativeBou nds, bool& rootRelativeBoundsComputed, |
| 124 const LayoutPoint& offsetFromRoot, PaintLayerFlags paintFlags) | 128 const LayoutPoint& offsetFromRoot, PaintLayerFlags paintFlags) |
| 125 : m_resourceClipper(0), m_paintLayer(paintLayer), m_context(context) | 129 : m_resourceClipper(0), m_paintLayer(paintLayer), m_context(context) |
| 126 { | 130 { |
| 127 const ComputedStyle& style = paintLayer.layoutObject()->styleRef(); | 131 const ComputedStyle& style = paintLayer.layoutObject()->styleRef(); |
| 128 | 132 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 SVGClipPainter(*m_resourceClipper).finishEffect(*m_paintLayer.layout Object(), m_context, m_clipperState); | 177 SVGClipPainter(*m_resourceClipper).finishEffect(*m_paintLayer.layout Object(), m_context, m_clipperState); |
| 174 } | 178 } |
| 175 private: | 179 private: |
| 176 LayoutSVGResourceClipper* m_resourceClipper; | 180 LayoutSVGResourceClipper* m_resourceClipper; |
| 177 Optional<ClipPathRecorder> m_clipPathRecorder; | 181 Optional<ClipPathRecorder> m_clipPathRecorder; |
| 178 SVGClipPainter::ClipperState m_clipperState; | 182 SVGClipPainter::ClipperState m_clipperState; |
| 179 const DeprecatedPaintLayer& m_paintLayer; | 183 const DeprecatedPaintLayer& m_paintLayer; |
| 180 GraphicsContext* m_context; | 184 GraphicsContext* m_context; |
| 181 }; | 185 }; |
| 182 | 186 |
| 183 void DeprecatedPaintLayerPainter::paintLayerContents(GraphicsContext* context, c onst DeprecatedPaintLayerPaintingInfo& paintingInfoArg, PaintLayerFlags paintFla gs, FragmentPolicy fragmentPolicy) | 187 DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintLayer Contents(GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& paint ingInfoArg, PaintLayerFlags paintFlags, FragmentPolicy fragmentPolicy) |
| 184 { | 188 { |
| 185 ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLay erDescendant()); | 189 ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLay erDescendant()); |
| 186 ASSERT(!(paintFlags & PaintLayerAppliedTransform)); | 190 ASSERT(!(paintFlags & PaintLayerAppliedTransform)); |
| 187 | 191 |
| 188 bool isSelfPaintingLayer = m_paintLayer.isSelfPaintingLayer(); | 192 bool isSelfPaintingLayer = m_paintLayer.isSelfPaintingLayer(); |
| 189 bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScr ollbars; | 193 bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScr ollbars; |
| 190 bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositing ScrollingPhase; | 194 bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositing ScrollingPhase; |
| 191 bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingComposi tingForegroundPhase; | 195 bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingComposi tingForegroundPhase; |
| 192 bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingComposi tingBackgroundPhase; | 196 bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingComposi tingBackgroundPhase; |
| 193 bool isPaintingOverflowContents = paintFlags & PaintLayerPaintingOverflowCon tents; | 197 bool isPaintingOverflowContents = paintFlags & PaintLayerPaintingOverflowCon tents; |
| 194 // Outline always needs to be painted even if we have no visible content. Al so, | 198 // Outline always needs to be painted even if we have no visible content. Al so, |
| 195 // the outline is painted in the background phase during composited scrollin g. | 199 // the outline is painted in the background phase during composited scrollin g. |
| 196 // If it were painted in the foreground phase, it would move with the scroll ed | 200 // If it were painted in the foreground phase, it would move with the scroll ed |
| 197 // content. When not composited scrolling, the outline is painted in the | 201 // content. When not composited scrolling, the outline is painted in the |
| 198 // foreground phase. Since scrolled contents are moved by paint invalidation in this | 202 // foreground phase. Since scrolled contents are moved by paint invalidation in this |
| 199 // case, the outline won't get 'dragged along'. | 203 // case, the outline won't get 'dragged along'. |
| 200 bool shouldPaintOutline = isSelfPaintingLayer && !isPaintingOverlayScrollbar s | 204 bool shouldPaintOutline = isSelfPaintingLayer && !isPaintingOverlayScrollbar s |
| 201 && ((isPaintingScrollingContent && isPaintingCompositedBackground) | 205 && ((isPaintingScrollingContent && isPaintingCompositedBackground) |
| 202 || (!isPaintingScrollingContent && isPaintingCompositedForeground)); | 206 || (!isPaintingScrollingContent && isPaintingCompositedForeground)); |
| 203 bool shouldPaintContent = m_paintLayer.hasVisibleContent() && isSelfPainting Layer && !isPaintingOverlayScrollbars; | 207 bool shouldPaintContent = m_paintLayer.hasVisibleContent() && isSelfPainting Layer && !isPaintingOverlayScrollbars; |
| 204 | 208 |
| 209 bool needsRepaint = m_paintLayer.needsRepaint(); | |
| 210 m_paintLayer.clearNeedsRepaint(); | |
| 211 | |
| 212 PaintResult result = FullyPainted; | |
| 213 | |
| 205 if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !m_paintLayer.layou tObject()->isLayoutView() && !m_paintLayer.layoutObject()->isDocumentElement()) | 214 if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !m_paintLayer.layou tObject()->isLayoutView() && !m_paintLayer.layoutObject()->isDocumentElement()) |
| 206 return; | 215 return result; |
| 216 | |
| 217 Optional<SubsequenceRecorder> subsequenceRecorder; | |
| 218 if (isPaintingOverlayScrollbars) { | |
| 219 // We should have cleared the repaint flag in the first pass. | |
| 220 ASSERT(!needsRepaint); | |
| 221 } else { | |
| 222 if (!needsRepaint && SubsequenceRecorder::useCachedSubsequenceIfPossible (*context, m_paintLayer)) | |
| 223 return result; | |
| 224 subsequenceRecorder.emplace(*context, m_paintLayer); | |
| 225 } | |
| 207 | 226 |
| 208 DeprecatedPaintLayerPaintingInfo paintingInfo = paintingInfoArg; | 227 DeprecatedPaintLayerPaintingInfo paintingInfo = paintingInfoArg; |
| 209 | 228 |
| 210 // Ensure our lists are up-to-date. | 229 // Ensure our lists are up-to-date. |
| 211 m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); | 230 m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); |
| 212 | 231 |
| 213 LayoutPoint offsetFromRoot; | 232 LayoutPoint offsetFromRoot; |
| 214 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); | 233 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); |
| 215 | 234 |
| 216 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking) | 235 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking) |
| 217 offsetFromRoot.move(m_paintLayer.subpixelAccumulation()); | 236 offsetFromRoot.move(m_paintLayer.subpixelAccumulation()); |
| 218 else | 237 else |
| 219 offsetFromRoot.move(paintingInfo.subPixelAccumulation); | 238 offsetFromRoot.move(paintingInfo.subPixelAccumulation); |
| 220 | 239 |
| 240 LayoutRect bounds = m_paintLayer.physicalBoundingBox(offsetFromRoot); | |
| 241 if (!paintingInfo.paintDirtyRect.contains(bounds)) | |
| 242 result = MaybeNotFullyPainted; | |
| 243 | |
| 221 LayoutRect rootRelativeBounds; | 244 LayoutRect rootRelativeBounds; |
| 222 bool rootRelativeBoundsComputed = false; | 245 bool rootRelativeBoundsComputed = false; |
| 223 | 246 |
| 224 if (paintingInfo.ancestorHasClipPathClipping && m_paintLayer.layoutObject()- >style()->position() != StaticPosition) | 247 if (paintingInfo.ancestorHasClipPathClipping && m_paintLayer.layoutObject()- >style()->position() != StaticPosition) |
| 225 UseCounter::count(m_paintLayer.layoutObject()->document(), UseCounter::C lipPathOfPositionedElement); | 248 UseCounter::count(m_paintLayer.layoutObject()->document(), UseCounter::C lipPathOfPositionedElement); |
| 226 | 249 |
| 227 // These helpers output clip and compositing operations using a RAII pattern . Stack-allocated-varibles are destructed in the reverse order of construction, | 250 // These helpers output clip and compositing operations using a RAII pattern . Stack-allocated-varibles are destructed in the reverse order of construction, |
| 228 // so they are nested properly. | 251 // so they are nested properly. |
| 229 ClipPathHelper clipPathHelper(context, m_paintLayer, paintingInfo, rootRelat iveBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags); | 252 ClipPathHelper clipPathHelper(context, m_paintLayer, paintingInfo, rootRelat iveBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags); |
| 230 | 253 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 246 | 269 |
| 247 DeprecatedPaintLayerFragments layerFragments; | 270 DeprecatedPaintLayerFragments layerFragments; |
| 248 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { | 271 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { |
| 249 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment. | 272 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment. |
| 250 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects ) ? UncachedClipRects : PaintingClipRects; | 273 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects ) ? UncachedClipRects : PaintingClipRects; |
| 251 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowCli p(paintFlags, m_paintLayer.layoutObject()); | 274 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowCli p(paintFlags, m_paintLayer.layoutObject()); |
| 252 if (fragmentPolicy == ForceSingleFragment) | 275 if (fragmentPolicy == ForceSingleFragment) |
| 253 m_paintLayer.appendSingleFragmentIgnoringPagination(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, Ignore OverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.su bPixelAccumulation); | 276 m_paintLayer.appendSingleFragmentIgnoringPagination(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, Ignore OverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.su bPixelAccumulation); |
| 254 else | 277 else |
| 255 m_paintLayer.collectFragments(layerFragments, localPaintingInfo.root Layer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation); | 278 m_paintLayer.collectFragments(layerFragments, localPaintingInfo.root Layer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation); |
| 256 if (shouldPaintContent) | 279 if (shouldPaintContent) { |
| 280 // TODO(wangxianzhu): This is for old slow scrolling. Implement simi lar optimization for slimming paint v2. | |
| 257 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra gments, localPaintingInfo, paintFlags, offsetFromRoot); | 281 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra gments, localPaintingInfo, paintFlags, offsetFromRoot); |
| 282 if (!shouldPaintContent) | |
| 283 result = MaybeNotFullyPainted; | |
| 284 } | |
| 258 } | 285 } |
| 259 | 286 |
| 260 bool selectionOnly = localPaintingInfo.globalPaintFlags() & GlobalPaintSelec tionOnly; | 287 bool selectionOnly = localPaintingInfo.globalPaintFlags() & GlobalPaintSelec tionOnly; |
| 261 // If this layer's layoutObject is a child of the paintingRoot, we paint unc onditionally, which | 288 // If this layer's layoutObject is a child of the paintingRoot, we paint unc onditionally, which |
| 262 // is done by passing a nil paintingRoot down to our layoutObject (as if no paintingRoot was ever set). | 289 // is done by passing a nil paintingRoot down to our layoutObject (as if no paintingRoot was ever set). |
| 263 // Else, our layout tree may or may not contain the painting root, so we pas s that root along | 290 // Else, our layout tree may or may not contain the painting root, so we pas s that root along |
| 264 // so it will be tested against as we descend through the layoutObjects. | 291 // so it will be tested against as we descend through the layoutObjects. |
| 265 LayoutObject* paintingRootForLayoutObject = 0; | 292 LayoutObject* paintingRootForLayoutObject = 0; |
| 266 if (localPaintingInfo.paintingRoot && !m_paintLayer.layoutObject()->isDescen dantOf(localPaintingInfo.paintingRoot)) | 293 if (localPaintingInfo.paintingRoot && !m_paintLayer.layoutObject()->isDescen dantOf(localPaintingInfo.paintingRoot)) |
| 267 paintingRootForLayoutObject = localPaintingInfo.paintingRoot; | 294 paintingRootForLayoutObject = localPaintingInfo.paintingRoot; |
| 268 | 295 |
| 269 { // Begin block for the lifetime of any filter. | 296 { // Begin block for the lifetime of any filter. |
| 270 FilterPainter filterPainter(m_paintLayer, context, offsetFromRoot, layer Fragments.isEmpty() ? ClipRect() : layerFragments[0].backgroundRect, localPainti ngInfo, paintFlags, | 297 FilterPainter filterPainter(m_paintLayer, context, offsetFromRoot, layer Fragments.isEmpty() ? ClipRect() : layerFragments[0].backgroundRect, localPainti ngInfo, paintFlags, |
| 271 rootRelativeBounds, rootRelativeBoundsComputed); | 298 rootRelativeBounds, rootRelativeBoundsComputed); |
| 272 | 299 |
| 273 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPai ntContent && !selectionOnly; | 300 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPai ntContent && !selectionOnly; |
| 274 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintin gOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackgr ound); | 301 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintin gOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackgr ound); |
| 275 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPa intContent; | 302 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPa intContent; |
| 276 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForegr ound; | 303 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForegr ound; |
| 277 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars; | 304 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars; |
| 278 | 305 |
| 279 if (shouldPaintBackground) { | 306 if (shouldPaintBackground) { |
| 280 paintBackgroundForFragments(layerFragments, context, paintingInfo.pa intDirtyRect, | 307 paintBackgroundForFragments(layerFragments, context, paintingInfo.pa intDirtyRect, |
| 281 localPaintingInfo, paintingRootForLayoutObject, paintFlags); | 308 localPaintingInfo, paintingRootForLayoutObject, paintFlags); |
| 282 } | 309 } |
| 283 | 310 |
| 284 if (shouldPaintNegZOrderList) | 311 if (shouldPaintNegZOrderList) { |
| 285 paintChildren(NegativeZOrderChildren, context, paintingInfo, paintFl ags); | 312 if (paintChildren(NegativeZOrderChildren, context, paintingInfo, pai ntFlags) == MaybeNotFullyPainted) |
| 313 result = MaybeNotFullyPainted; | |
| 314 } | |
| 286 | 315 |
| 287 if (shouldPaintOwnContents) { | 316 if (shouldPaintOwnContents) { |
| 288 paintForegroundForFragments(layerFragments, context, paintingInfo.pa intDirtyRect, | 317 paintForegroundForFragments(layerFragments, context, paintingInfo.pa intDirtyRect, |
| 289 localPaintingInfo, paintingRootForLayoutObject, selectionOnly, p aintFlags); | 318 localPaintingInfo, paintingRootForLayoutObject, selectionOnly, p aintFlags); |
| 290 } | 319 } |
| 291 | 320 |
| 292 if (shouldPaintOutline) | 321 if (shouldPaintOutline) |
| 293 paintOutlineForFragments(layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags); | 322 paintOutlineForFragments(layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags); |
| 294 | 323 |
| 295 if (shouldPaintNormalFlowAndPosZOrderLists) | 324 if (shouldPaintNormalFlowAndPosZOrderLists) { |
| 296 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, paintingInfo, paintFlags); | 325 if (paintChildren(NormalFlowChildren | PositiveZOrderChildren, conte xt, paintingInfo, paintFlags) == MaybeNotFullyPainted) |
| 326 result = MaybeNotFullyPainted; | |
| 327 } | |
| 297 | 328 |
| 298 if (shouldPaintOverlayScrollbars) | 329 if (shouldPaintOverlayScrollbars) |
| 299 paintOverflowControlsForFragments(layerFragments, context, localPain tingInfo, paintFlags); | 330 paintOverflowControlsForFragments(layerFragments, context, localPain tingInfo, paintFlags); |
| 300 } // FilterPainter block | 331 } // FilterPainter block |
| 301 | 332 |
| 302 bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && m_paintLayer.layoutObject()->hasMask() && !selectionOn ly; | 333 bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && m_paintLayer.layoutObject()->hasMask() && !selectionOn ly; |
| 303 bool shouldPaintClippingMask = (paintFlags & PaintLayerPaintingChildClipping MaskPhase) && shouldPaintContent && !selectionOnly; | 334 bool shouldPaintClippingMask = (paintFlags & PaintLayerPaintingChildClipping MaskPhase) && shouldPaintContent && !selectionOnly; |
| 304 | 335 |
| 305 if (shouldPaintMask) | 336 if (shouldPaintMask) |
| 306 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForLayoutObject, paintFlags); | 337 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForLayoutObject, paintFlags); |
| 307 if (shouldPaintClippingMask) { | 338 if (shouldPaintClippingMask) { |
| 308 // Paint the border radius mask for the fragments. | 339 // Paint the border radius mask for the fragments. |
| 309 paintChildClippingMaskForFragments(layerFragments, context, localPaintin gInfo, paintingRootForLayoutObject, paintFlags); | 340 paintChildClippingMaskForFragments(layerFragments, context, localPaintin gInfo, paintingRootForLayoutObject, paintFlags); |
| 310 } | 341 } |
| 342 | |
| 343 // Set subsequence not cacheable if the bounding box of this layer and desce ndants is not fully contained | |
| 344 // by paintRect, because later paintRect changes may expose new contents whi ch will need repainting. | |
| 345 if (result == MaybeNotFullyPainted && subsequenceRecorder) | |
| 346 subsequenceRecorder->setUncacheable(); | |
| 347 | |
| 348 return result; | |
| 311 } | 349 } |
| 312 | 350 |
| 313 bool DeprecatedPaintLayerPainter::needsToClip(const DeprecatedPaintLayerPainting Info& localPaintingInfo, const ClipRect& clipRect) | 351 bool DeprecatedPaintLayerPainter::needsToClip(const DeprecatedPaintLayerPainting Info& localPaintingInfo, const ClipRect& clipRect) |
| 314 { | 352 { |
| 315 return clipRect.rect() != localPaintingInfo.paintDirtyRect || clipRect.hasRa dius(); | 353 return clipRect.rect() != localPaintingInfo.paintDirtyRect || clipRect.hasRa dius(); |
| 316 } | 354 } |
| 317 | 355 |
| 318 bool DeprecatedPaintLayerPainter::atLeastOneFragmentIntersectsDamageRect(Depreca tedPaintLayerFragments& fragments, const DeprecatedPaintLayerPaintingInfo& local PaintingInfo, PaintLayerFlags localPaintFlags, const LayoutPoint& offsetFromRoot ) | 356 bool DeprecatedPaintLayerPainter::atLeastOneFragmentIntersectsDamageRect(Depreca tedPaintLayerFragments& fragments, const DeprecatedPaintLayerPaintingInfo& local PaintingInfo, PaintLayerFlags localPaintFlags, const LayoutPoint& offsetFromRoot ) |
| 319 { | 357 { |
| 320 if (m_paintLayer.enclosingPaginationLayer()) | 358 if (m_paintLayer.enclosingPaginationLayer()) |
| 321 return true; // The fragments created have already been found to interse ct with the damage rect. | 359 return true; // The fragments created have already been found to interse ct with the damage rect. |
| 322 | 360 |
| 323 if (&m_paintLayer == localPaintingInfo.rootLayer && (localPaintFlags & Paint LayerPaintingOverflowContents)) | 361 if (&m_paintLayer == localPaintingInfo.rootLayer && (localPaintFlags & Paint LayerPaintingOverflowContents)) |
| 324 return true; | 362 return true; |
| 325 | 363 |
| 326 for (DeprecatedPaintLayerFragment& fragment: fragments) { | 364 for (DeprecatedPaintLayerFragment& fragment: fragments) { |
| 327 LayoutPoint newOffsetFromRoot = offsetFromRoot + fragment.paginationOffs et; | 365 LayoutPoint newOffsetFromRoot = offsetFromRoot + fragment.paginationOffs et; |
| 328 // Note that this really only works reliably on the first fragment. If t he layer has visible | 366 // Note that this really only works reliably on the first fragment. If t he layer has visible |
| 329 // overflow and a subsequent fragment doesn't intersect with the border box of the layer | 367 // overflow and a subsequent fragment doesn't intersect with the border box of the layer |
| 330 // (i.e. only contains an overflow portion of the layer), intersection w ill fail. The reason | 368 // (i.e. only contains an overflow portion of the layer), intersection w ill fail. The reason |
| 331 // for this is that fragment.layerBounds is set to the border box, not t he bounding box, of | 369 // for this is that fragment.layerBounds is set to the border box, not t he bounding box, of |
| 332 // the layer. | 370 // the layer. |
| 333 if (m_paintLayer.intersectsDamageRect(fragment.layerBounds, fragment.bac kgroundRect.rect(), newOffsetFromRoot)) | 371 if (m_paintLayer.intersectsDamageRect(fragment.layerBounds, fragment.bac kgroundRect.rect(), newOffsetFromRoot)) |
| 334 return true; | 372 return true; |
| 335 } | 373 } |
| 336 return false; | 374 return false; |
| 337 } | 375 } |
| 338 | 376 |
| 339 void DeprecatedPaintLayerPainter::paintLayerWithTransform(GraphicsContext* conte xt, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintF lags) | 377 DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintLayer WithTransform(GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
| 340 { | 378 { |
| 341 TransformationMatrix layerTransform = m_paintLayer.renderableTransform(paint ingInfo.globalPaintFlags()); | 379 TransformationMatrix layerTransform = m_paintLayer.renderableTransform(paint ingInfo.globalPaintFlags()); |
| 342 // If the transform can't be inverted, then don't paint anything. | 380 // If the transform can't be inverted, then don't paint anything. |
| 343 if (!layerTransform.isInvertible()) | 381 if (!layerTransform.isInvertible()) |
| 344 return; | 382 return FullyPainted; |
| 345 | 383 |
| 346 // FIXME: We should make sure that we don't walk past paintingInfo.rootLayer here. | 384 // FIXME: We should make sure that we don't walk past paintingInfo.rootLayer here. |
| 347 // m_paintLayer may be the "root", and then we should avoid looking at its p arent. | 385 // m_paintLayer may be the "root", and then we should avoid looking at its p arent. |
| 348 DeprecatedPaintLayer* parentLayer = m_paintLayer.parent(); | 386 DeprecatedPaintLayer* parentLayer = m_paintLayer.parent(); |
| 349 | 387 |
| 350 ClipRect ancestorBackgroundClipRect; | 388 ClipRect ancestorBackgroundClipRect; |
| 351 if (parentLayer) { | 389 if (parentLayer) { |
| 352 // Calculate the clip rectangle that the ancestors establish. | 390 // Calculate the clip rectangle that the ancestors establish. |
| 353 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, IgnoreOver layScrollbarSize); | 391 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, IgnoreOver layScrollbarSize); |
| 354 if (shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject()) = = IgnoreOverflowClip) | 392 if (shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject()) = = IgnoreOverflowClip) |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 373 // We don't need to collect any fragments in the regular way here. We ha ve already | 411 // We don't need to collect any fragments in the regular way here. We ha ve already |
| 374 // calculated a clip rectangle for the ancestry if it was needed, and cl ipping this | 412 // calculated a clip rectangle for the ancestry if it was needed, and cl ipping this |
| 375 // layer is something that can be done further down the path, when the t ransform has | 413 // layer is something that can be done further down the path, when the t ransform has |
| 376 // been applied. | 414 // been applied. |
| 377 DeprecatedPaintLayerFragment fragment; | 415 DeprecatedPaintLayerFragment fragment; |
| 378 fragment.backgroundRect = paintingInfo.paintDirtyRect; | 416 fragment.backgroundRect = paintingInfo.paintDirtyRect; |
| 379 fragments.append(fragment); | 417 fragments.append(fragment); |
| 380 } | 418 } |
| 381 | 419 |
| 382 bool needsScope = fragments.size() > 1; | 420 bool needsScope = fragments.size() > 1; |
| 421 PaintResult result = FullyPainted; | |
| 383 for (const auto& fragment : fragments) { | 422 for (const auto& fragment : fragments) { |
| 384 Optional<ScopeRecorder> scopeRecorder; | 423 Optional<ScopeRecorder> scopeRecorder; |
| 385 if (needsScope) | 424 if (needsScope) |
| 386 scopeRecorder.emplace(*context); | 425 scopeRecorder.emplace(*context); |
| 387 Optional<LayerClipRecorder> clipRecorder; | 426 Optional<LayerClipRecorder> clipRecorder; |
| 388 if (parentLayer) { | 427 if (parentLayer) { |
| 389 ClipRect clipRectForFragment(ancestorBackgroundClipRect); | 428 ClipRect clipRectForFragment(ancestorBackgroundClipRect); |
| 390 clipRectForFragment.moveBy(fragment.paginationOffset); | 429 clipRectForFragment.moveBy(fragment.paginationOffset); |
| 391 clipRectForFragment.intersect(fragment.backgroundRect); | 430 clipRectForFragment.intersect(fragment.backgroundRect); |
| 392 if (clipRectForFragment.isEmpty()) | 431 if (clipRectForFragment.isEmpty()) |
| 393 continue; | 432 continue; |
| 394 if (needsToClip(paintingInfo, clipRectForFragment)) { | 433 if (needsToClip(paintingInfo, clipRectForFragment)) { |
| 395 if (m_paintLayer.layoutObject()->style()->position() != StaticPo sition && clipRectForFragment.isClippedByClipCss()) | 434 if (m_paintLayer.layoutObject()->style()->position() != StaticPo sition && clipRectForFragment.isClippedByClipCss()) |
| 396 UseCounter::count(m_paintLayer.layoutObject()->document(), U seCounter::ClipCssOfPositionedElement); | 435 UseCounter::count(m_paintLayer.layoutObject()->document(), U seCounter::ClipCssOfPositionedElement); |
| 397 clipRecorder.emplace(*context, *parentLayer->layoutObject(), Dis playItem::ClipLayerParent, clipRectForFragment, &paintingInfo, fragment.paginati onOffset, paintFlags); | 436 clipRecorder.emplace(*context, *parentLayer->layoutObject(), Dis playItem::ClipLayerParent, clipRectForFragment, &paintingInfo, fragment.paginati onOffset, paintFlags); |
| 398 } | 437 } |
| 399 } | 438 } |
| 400 | 439 if (paintFragmentByApplyingTransform(context, paintingInfo, paintFlags, fragment.paginationOffset) == MaybeNotFullyPainted) |
| 401 paintFragmentByApplyingTransform(context, paintingInfo, paintFlags, frag ment.paginationOffset); | 440 result = MaybeNotFullyPainted; |
| 402 } | 441 } |
| 442 return result; | |
| 403 } | 443 } |
| 404 | 444 |
| 405 void DeprecatedPaintLayerPainter::paintFragmentByApplyingTransform(GraphicsConte xt* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFla gs paintFlags, const LayoutPoint& fragmentTranslation) | 445 DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintFragm entByApplyingTransform(GraphicsContext* context, const DeprecatedPaintLayerPaint ingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& fragmentTr anslation) |
| 406 { | 446 { |
| 407 // This involves subtracting out the position of the layer in our current co ordinate space, but preserving | 447 // This involves subtracting out the position of the layer in our current co ordinate space, but preserving |
| 408 // the accumulated error for sub-pixel layout. | 448 // the accumulated error for sub-pixel layout. |
| 409 LayoutPoint delta; | 449 LayoutPoint delta; |
| 410 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, delta); | 450 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, delta); |
| 411 delta.moveBy(fragmentTranslation); | 451 delta.moveBy(fragmentTranslation); |
| 412 TransformationMatrix transform(m_paintLayer.renderableTransform(paintingInfo .globalPaintFlags())); | 452 TransformationMatrix transform(m_paintLayer.renderableTransform(paintingInfo .globalPaintFlags())); |
| 413 IntPoint roundedDelta = roundedIntPoint(delta); | 453 IntPoint roundedDelta = roundedIntPoint(delta); |
| 414 transform.translateRight(roundedDelta.x(), roundedDelta.y()); | 454 transform.translateRight(roundedDelta.x(), roundedDelta.y()); |
| 415 LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation + (delta - roundedDelta); | 455 LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation + (delta - roundedDelta); |
| 416 | 456 |
| 417 Transform3DRecorder transform3DRecorder(*context, *m_paintLayer.layoutObject (), DisplayItem::Transform3DElementTransform, transform); | 457 Transform3DRecorder transform3DRecorder(*context, *m_paintLayer.layoutObject (), DisplayItem::Transform3DElementTransform, transform); |
| 418 | 458 |
| 419 // Now do a paint with the root layer shifted to be us. | 459 // Now do a paint with the root layer shifted to be us. |
| 420 DeprecatedPaintLayerPaintingInfo transformedPaintingInfo(&m_paintLayer, Layo utRect(enclosingIntRect(transform.inverse().mapRect(paintingInfo.paintDirtyRect) )), paintingInfo.globalPaintFlags(), | 460 DeprecatedPaintLayerPaintingInfo transformedPaintingInfo(&m_paintLayer, Layo utRect(enclosingIntRect(transform.inverse().mapRect(paintingInfo.paintDirtyRect) )), paintingInfo.globalPaintFlags(), |
| 421 adjustedSubPixelAccumulation, paintingInfo.paintingRoot); | 461 adjustedSubPixelAccumulation, paintingInfo.paintingRoot); |
| 422 transformedPaintingInfo.ancestorHasClipPathClipping = paintingInfo.ancestorH asClipPathClipping; | 462 transformedPaintingInfo.ancestorHasClipPathClipping = paintingInfo.ancestorH asClipPathClipping; |
| 423 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags , ForceSingleFragment); | 463 return paintLayerContentsAndReflection(context, transformedPaintingInfo, pai ntFlags, ForceSingleFragment); |
| 424 } | 464 } |
| 425 | 465 |
| 426 void DeprecatedPaintLayerPainter::paintChildren(unsigned childrenToVisit, Graphi csContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintL ayerFlags paintFlags) | 466 DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintChild ren(unsigned childrenToVisit, GraphicsContext* context, const DeprecatedPaintLay erPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
| 427 { | 467 { |
| 468 PaintResult result = FullyPainted; | |
| 428 if (!m_paintLayer.hasSelfPaintingLayerDescendant()) | 469 if (!m_paintLayer.hasSelfPaintingLayerDescendant()) |
| 429 return; | 470 return result; |
| 430 | 471 |
| 431 #if ENABLE(ASSERT) | 472 #if ENABLE(ASSERT) |
| 432 LayerListMutationDetector mutationChecker(m_paintLayer.stackingNode()); | 473 LayerListMutationDetector mutationChecker(m_paintLayer.stackingNode()); |
| 433 #endif | 474 #endif |
| 434 | 475 |
| 435 IntSize scrollOffsetAccumulation = paintingInfo.scrollOffsetAccumulation; | 476 IntSize scrollOffsetAccumulation = paintingInfo.scrollOffsetAccumulation; |
| 436 if (m_paintLayer.layoutObject()->hasOverflowClip()) | 477 if (m_paintLayer.layoutObject()->hasOverflowClip()) |
| 437 scrollOffsetAccumulation += m_paintLayer.layoutBox()->scrolledContentOff set(); | 478 scrollOffsetAccumulation += m_paintLayer.layoutBox()->scrolledContentOff set(); |
| 438 | 479 |
| 439 DeprecatedPaintLayerStackingNodeIterator iterator(*m_paintLayer.stackingNode (), childrenToVisit); | 480 DeprecatedPaintLayerStackingNodeIterator iterator(*m_paintLayer.stackingNode (), childrenToVisit); |
| 440 while (DeprecatedPaintLayerStackingNode* child = iterator.next()) { | 481 while (DeprecatedPaintLayerStackingNode* child = iterator.next()) { |
| 441 DeprecatedPaintLayerPainter childPainter(*child->layer()); | 482 DeprecatedPaintLayerPainter childPainter(*child->layer()); |
| 442 // If this Layer should paint into its own backing or a grouped backing, that will be done via CompositedDeprecatedPaintLayerMapping::paintContents() | 483 // If this Layer should paint into its own backing or a grouped backing, that will be done via CompositedDeprecatedPaintLayerMapping::paintContents() |
| 443 // and CompositedDeprecatedPaintLayerMapping::doPaintTask(). | 484 // and CompositedDeprecatedPaintLayerMapping::doPaintTask(). |
| 444 if (!childPainter.shouldPaintLayerInSoftwareMode(paintingInfo.globalPain tFlags(), paintFlags)) | 485 if (!childPainter.shouldPaintLayerInSoftwareMode(paintingInfo.globalPain tFlags(), paintFlags)) |
| 445 continue; | 486 continue; |
| 446 | 487 |
| 447 DeprecatedPaintLayerPaintingInfo childPaintingInfo = paintingInfo; | 488 DeprecatedPaintLayerPaintingInfo childPaintingInfo = paintingInfo; |
| 448 childPaintingInfo.scrollOffsetAccumulation = scrollOffsetAccumulation; | 489 childPaintingInfo.scrollOffsetAccumulation = scrollOffsetAccumulation; |
| 449 // Rare case: accumulate scroll offset of non-stacking-context ancestors up to m_paintLayer. | 490 // Rare case: accumulate scroll offset of non-stacking-context ancestors up to m_paintLayer. |
| 450 for (DeprecatedPaintLayer* parentLayer = child->layer()->parent(); paren tLayer != &m_paintLayer; parentLayer = parentLayer->parent()) { | 491 for (DeprecatedPaintLayer* parentLayer = child->layer()->parent(); paren tLayer != &m_paintLayer; parentLayer = parentLayer->parent()) { |
| 451 if (parentLayer->layoutObject()->hasOverflowClip()) | 492 if (parentLayer->layoutObject()->hasOverflowClip()) |
| 452 childPaintingInfo.scrollOffsetAccumulation += parentLayer->layou tBox()->scrolledContentOffset(); | 493 childPaintingInfo.scrollOffsetAccumulation += parentLayer->layou tBox()->scrolledContentOffset(); |
| 453 } | 494 } |
| 454 | 495 |
| 455 childPainter.paintLayer(context, childPaintingInfo, paintFlags); | 496 if (childPainter.paintLayer(context, childPaintingInfo, paintFlags) == M aybeNotFullyPainted) |
| 497 result = MaybeNotFullyPainted; | |
| 456 } | 498 } |
| 499 return result; | |
| 457 } | 500 } |
| 458 | 501 |
| 459 // FIXME: inline this. | 502 // FIXME: inline this. |
| 460 static bool paintForFixedRootBackground(const DeprecatedPaintLayer* layer, Paint LayerFlags paintFlags) | 503 static bool paintForFixedRootBackground(const DeprecatedPaintLayer* layer, Paint LayerFlags paintFlags) |
| 461 { | 504 { |
| 462 return layer->layoutObject()->isDocumentElement() && (paintFlags & PaintLaye rPaintingRootBackgroundOnly); | 505 return layer->layoutObject()->isDocumentElement() && (paintFlags & PaintLaye rPaintingRootBackgroundOnly); |
| 463 } | 506 } |
| 464 | 507 |
| 465 bool DeprecatedPaintLayerPainter::shouldPaintLayerInSoftwareMode(const GlobalPai ntFlags globalPaintFlags, PaintLayerFlags paintFlags) | 508 bool DeprecatedPaintLayerPainter::shouldPaintLayerInSoftwareMode(const GlobalPai ntFlags globalPaintFlags, PaintLayerFlags paintFlags) |
| 466 { | 509 { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 621 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 664 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
| 622 return; | 665 return; |
| 623 | 666 |
| 624 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); | 667 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); |
| 625 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 668 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
| 626 | 669 |
| 627 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 670 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
| 628 } | 671 } |
| 629 | 672 |
| 630 } // namespace blink | 673 } // namespace blink |
| OLD | NEW |