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" |
| 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/LayerDescendantClipRecorder.h" | |
| 18 #include "core/paint/LayerFixedPositionRecorder.h" | 19 #include "core/paint/LayerFixedPositionRecorder.h" |
| 19 #include "core/paint/PaintInfo.h" | 20 #include "core/paint/PaintInfo.h" |
| 20 #include "core/paint/SVGClipPainter.h" | 21 #include "core/paint/SVGClipPainter.h" |
| 21 #include "core/paint/ScopeRecorder.h" | 22 #include "core/paint/ScopeRecorder.h" |
| 22 #include "core/paint/ScrollRecorder.h" | 23 #include "core/paint/ScrollRecorder.h" |
| 23 #include "core/paint/ScrollableAreaPainter.h" | 24 #include "core/paint/ScrollableAreaPainter.h" |
| 24 #include "core/paint/Transform3DRecorder.h" | 25 #include "core/paint/Transform3DRecorder.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" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 return result; | 224 return result; |
| 224 subsequenceRecorder.emplace(*context, m_paintLayer); | 225 subsequenceRecorder.emplace(*context, m_paintLayer); |
| 225 } | 226 } |
| 226 | 227 |
| 227 DeprecatedPaintLayerPaintingInfo paintingInfo = paintingInfoArg; | 228 DeprecatedPaintLayerPaintingInfo paintingInfo = paintingInfoArg; |
| 228 | 229 |
| 229 // Ensure our lists are up-to-date. | 230 // Ensure our lists are up-to-date. |
| 230 m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); | 231 m_paintLayer.stackingNode()->updateLayerListsIfNeeded(); |
| 231 | 232 |
| 232 LayoutPoint offsetFromRoot; | 233 LayoutPoint offsetFromRoot; |
| 233 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot); | 234 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 235 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot , DeprecatedPaintLayer::ExcludeScroll); | |
| 236 else | |
| 237 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot ); | |
| 234 | 238 |
| 235 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking) | 239 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking) |
| 236 offsetFromRoot.move(m_paintLayer.subpixelAccumulation()); | 240 offsetFromRoot.move(m_paintLayer.subpixelAccumulation()); |
| 237 else | 241 else |
| 238 offsetFromRoot.move(paintingInfo.subPixelAccumulation); | 242 offsetFromRoot.move(paintingInfo.subPixelAccumulation); |
| 239 | 243 |
| 240 LayoutRect bounds = m_paintLayer.physicalBoundingBox(offsetFromRoot); | 244 LayoutRect bounds = m_paintLayer.physicalBoundingBox(offsetFromRoot); |
| 241 if (!paintingInfo.paintDirtyRect.contains(bounds)) | 245 if (!paintingInfo.paintDirtyRect.contains(bounds)) |
| 242 result = MaybeNotFullyPainted; | 246 result = MaybeNotFullyPainted; |
| 243 | 247 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 265 | 269 |
| 266 DeprecatedPaintLayerPaintingInfo localPaintingInfo(paintingInfo); | 270 DeprecatedPaintLayerPaintingInfo localPaintingInfo(paintingInfo); |
| 267 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking) | 271 if (m_paintLayer.compositingState() == PaintsIntoOwnBacking) |
| 268 localPaintingInfo.subPixelAccumulation = m_paintLayer.subpixelAccumulati on(); | 272 localPaintingInfo.subPixelAccumulation = m_paintLayer.subpixelAccumulati on(); |
| 269 | 273 |
| 270 DeprecatedPaintLayerFragments layerFragments; | 274 DeprecatedPaintLayerFragments layerFragments; |
| 271 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { | 275 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { |
| 272 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment. | 276 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment. |
| 273 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects ) ? UncachedClipRects : PaintingClipRects; | 277 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects ) ? UncachedClipRects : PaintingClipRects; |
| 274 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowCli p(paintFlags, m_paintLayer.layoutObject()); | 278 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowCli p(paintFlags, m_paintLayer.layoutObject()); |
| 275 if (fragmentPolicy == ForceSingleFragment) | 279 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 280 // TODO(trchen): Need to handle layer fragmentation. | |
|
chrishtr
2015/09/17 18:07:53
How hard will this be? We need a clear plan for it
| |
| 281 DeprecatedPaintLayerFragment fragment; | |
| 282 fragment.layerBounds = LayoutRect(offsetFromRoot, LayoutSize(m_paint Layer.size())); | |
| 283 fragment.backgroundRect = LayoutRect::infiniteRect(); | |
| 284 fragment.foregroundRect = LayoutRect::infiniteRect(); | |
| 285 fragment.outlineRect = LayoutRect::infiniteRect(); | |
| 286 layerFragments.append(fragment); | |
| 287 } else if (fragmentPolicy == ForceSingleFragment) { | |
| 276 m_paintLayer.appendSingleFragmentIgnoringPagination(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, Ignore OverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.su bPixelAccumulation); | 288 m_paintLayer.appendSingleFragmentIgnoringPagination(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, Ignore OverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.su bPixelAccumulation); |
| 277 else | 289 } else { |
| 278 m_paintLayer.collectFragments(layerFragments, localPaintingInfo.root Layer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation); | 290 m_paintLayer.collectFragments(layerFragments, localPaintingInfo.root Layer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation); |
| 291 } | |
| 279 if (shouldPaintContent) { | 292 if (shouldPaintContent) { |
| 280 // TODO(wangxianzhu): This is for old slow scrolling. Implement simi lar optimization for slimming paint v2. | 293 // TODO(wangxianzhu): This is for old slow scrolling. Implement simi lar optimization for slimming paint v2. |
| 281 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra gments, localPaintingInfo, paintFlags, offsetFromRoot); | 294 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra gments, localPaintingInfo, paintFlags, offsetFromRoot); |
| 282 if (!shouldPaintContent) | 295 if (!shouldPaintContent) |
| 283 result = MaybeNotFullyPainted; | 296 result = MaybeNotFullyPainted; |
| 284 } | 297 } |
| 285 } | 298 } |
| 286 | 299 |
| 287 bool selectionOnly = localPaintingInfo.globalPaintFlags() & GlobalPaintSelec tionOnly; | 300 bool selectionOnly = localPaintingInfo.globalPaintFlags() & GlobalPaintSelec tionOnly; |
| 288 // If this layer's layoutObject is a child of the paintingRoot, we paint unc onditionally, which | 301 // If this layer's layoutObject is a child of the paintingRoot, we paint unc onditionally, which |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 343 // Set subsequence not cacheable if the bounding box of this layer and desce ndants is not fully contained | 356 // 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. | 357 // by paintRect, because later paintRect changes may expose new contents whi ch will need repainting. |
| 345 if (result == MaybeNotFullyPainted && subsequenceRecorder) | 358 if (result == MaybeNotFullyPainted && subsequenceRecorder) |
| 346 subsequenceRecorder->setUncacheable(); | 359 subsequenceRecorder->setUncacheable(); |
| 347 | 360 |
| 348 return result; | 361 return result; |
| 349 } | 362 } |
| 350 | 363 |
| 351 bool DeprecatedPaintLayerPainter::needsToClip(const DeprecatedPaintLayerPainting Info& localPaintingInfo, const ClipRect& clipRect) | 364 bool DeprecatedPaintLayerPainter::needsToClip(const DeprecatedPaintLayerPainting Info& localPaintingInfo, const ClipRect& clipRect) |
| 352 { | 365 { |
| 366 // With SPv2 a layer clips its descendants so a layer never clips itself. | |
| 367 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
| 368 return false; | |
| 353 return clipRect.rect() != localPaintingInfo.paintDirtyRect || clipRect.hasRa dius(); | 369 return clipRect.rect() != localPaintingInfo.paintDirtyRect || clipRect.hasRa dius(); |
| 354 } | 370 } |
| 355 | 371 |
| 356 bool DeprecatedPaintLayerPainter::atLeastOneFragmentIntersectsDamageRect(Depreca tedPaintLayerFragments& fragments, const DeprecatedPaintLayerPaintingInfo& local PaintingInfo, PaintLayerFlags localPaintFlags, const LayoutPoint& offsetFromRoot ) | 372 bool DeprecatedPaintLayerPainter::atLeastOneFragmentIntersectsDamageRect(Depreca tedPaintLayerFragments& fragments, const DeprecatedPaintLayerPaintingInfo& local PaintingInfo, PaintLayerFlags localPaintFlags, const LayoutPoint& offsetFromRoot ) |
| 357 { | 373 { |
| 358 if (m_paintLayer.enclosingPaginationLayer()) | 374 if (m_paintLayer.enclosingPaginationLayer()) |
| 359 return true; // The fragments created have already been found to interse ct with the damage rect. | 375 return true; // The fragments created have already been found to interse ct with the damage rect. |
| 360 | 376 |
| 361 if (&m_paintLayer == localPaintingInfo.rootLayer && (localPaintFlags & Paint LayerPaintingOverflowContents)) | 377 if (&m_paintLayer == localPaintingInfo.rootLayer && (localPaintFlags & Paint LayerPaintingOverflowContents)) |
| 362 return true; | 378 return true; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintChild ren(unsigned childrenToVisit, GraphicsContext* context, const DeprecatedPaintLay erPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 482 DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintChild ren(unsigned childrenToVisit, GraphicsContext* context, const DeprecatedPaintLay erPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
| 467 { | 483 { |
| 468 PaintResult result = FullyPainted; | 484 PaintResult result = FullyPainted; |
| 469 if (!m_paintLayer.hasSelfPaintingLayerDescendant()) | 485 if (!m_paintLayer.hasSelfPaintingLayerDescendant()) |
| 470 return result; | 486 return result; |
| 471 | 487 |
| 472 #if ENABLE(ASSERT) | 488 #if ENABLE(ASSERT) |
| 473 LayerListMutationDetector mutationChecker(m_paintLayer.stackingNode()); | 489 LayerListMutationDetector mutationChecker(m_paintLayer.stackingNode()); |
| 474 #endif | 490 #endif |
| 475 | 491 |
| 492 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
| 493 return paintChildrenWithFullScrollClipChain(childrenToVisit, context, pa intingInfo, paintFlags); | |
| 494 | |
| 476 IntSize scrollOffsetAccumulation = paintingInfo.scrollOffsetAccumulation; | 495 IntSize scrollOffsetAccumulation = paintingInfo.scrollOffsetAccumulation; |
| 477 if (m_paintLayer.layoutObject()->hasOverflowClip()) | 496 if (m_paintLayer.layoutObject()->hasOverflowClip()) |
| 478 scrollOffsetAccumulation += m_paintLayer.layoutBox()->scrolledContentOff set(); | 497 scrollOffsetAccumulation += m_paintLayer.layoutBox()->scrolledContentOff set(); |
| 479 | 498 |
| 480 DeprecatedPaintLayerStackingNodeIterator iterator(*m_paintLayer.stackingNode (), childrenToVisit); | 499 DeprecatedPaintLayerStackingNodeIterator iterator(*m_paintLayer.stackingNode (), childrenToVisit); |
| 481 while (DeprecatedPaintLayerStackingNode* child = iterator.next()) { | 500 while (DeprecatedPaintLayerStackingNode* child = iterator.next()) { |
| 482 DeprecatedPaintLayerPainter childPainter(*child->layer()); | 501 DeprecatedPaintLayerPainter childPainter(*child->layer()); |
| 483 // If this Layer should paint into its own backing or a grouped backing, that will be done via CompositedDeprecatedPaintLayerMapping::paintContents() | 502 // If this Layer should paint into its own backing or a grouped backing, that will be done via CompositedDeprecatedPaintLayerMapping::paintContents() |
| 484 // and CompositedDeprecatedPaintLayerMapping::doPaintTask(). | 503 // and CompositedDeprecatedPaintLayerMapping::doPaintTask(). |
| 485 if (!childPainter.shouldPaintLayerInSoftwareMode(paintingInfo.globalPain tFlags(), paintFlags)) | 504 if (!childPainter.shouldPaintLayerInSoftwareMode(paintingInfo.globalPain tFlags(), paintFlags)) |
| 486 continue; | 505 continue; |
| 487 | 506 |
| 488 DeprecatedPaintLayerPaintingInfo childPaintingInfo = paintingInfo; | 507 DeprecatedPaintLayerPaintingInfo childPaintingInfo = paintingInfo; |
| 489 childPaintingInfo.scrollOffsetAccumulation = scrollOffsetAccumulation; | 508 childPaintingInfo.scrollOffsetAccumulation = scrollOffsetAccumulation; |
| 490 // Rare case: accumulate scroll offset of non-stacking-context ancestors up to m_paintLayer. | 509 // Rare case: accumulate scroll offset of non-stacking-context ancestors up to m_paintLayer. |
| 491 for (DeprecatedPaintLayer* parentLayer = child->layer()->parent(); paren tLayer != &m_paintLayer; parentLayer = parentLayer->parent()) { | 510 for (DeprecatedPaintLayer* parentLayer = child->layer()->parent(); paren tLayer != &m_paintLayer; parentLayer = parentLayer->parent()) { |
| 492 if (parentLayer->layoutObject()->hasOverflowClip()) | 511 if (parentLayer->layoutObject()->hasOverflowClip()) |
| 493 childPaintingInfo.scrollOffsetAccumulation += parentLayer->layou tBox()->scrolledContentOffset(); | 512 childPaintingInfo.scrollOffsetAccumulation += parentLayer->layou tBox()->scrolledContentOffset(); |
| 494 } | 513 } |
| 495 | 514 |
| 496 if (childPainter.paintLayer(context, childPaintingInfo, paintFlags) == M aybeNotFullyPainted) | 515 if (childPainter.paintLayer(context, childPaintingInfo, paintFlags) == M aybeNotFullyPainted) |
| 497 result = MaybeNotFullyPainted; | 516 result = MaybeNotFullyPainted; |
| 498 } | 517 } |
| 499 return result; | 518 return result; |
| 500 } | 519 } |
| 501 | 520 |
| 521 static DeprecatedPaintLayerPainter::PaintResult recursivelyScrollAndPaintChildLa yer(Vector<DeprecatedPaintLayer*>& clippingAncestors, DeprecatedPaintLayer& chil d, GraphicsContext& context, const DeprecatedPaintLayerPaintingInfo& paintingInf o, PaintLayerFlags paintFlags, DeprecatedPaintLayer* paintOffsetBase, LayoutPoin t paintOffset) | |
|
chrishtr
2015/09/17 00:53:46
This looks like a bottom-up approach: when encount
trchen
2015/09/17 01:56:04
Only up to the nearest self-painting ancestor. i.e
| |
| 522 { | |
| 523 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
| 524 if (clippingAncestors.isEmpty()) | |
| 525 return DeprecatedPaintLayerPainter(child).paintLayer(&context, paintingI nfo, paintFlags); | |
| 526 DeprecatedPaintLayer* layer = clippingAncestors.last(); | |
| 527 clippingAncestors.removeLast(); | |
| 528 | |
| 529 ASSERT(layer->layoutObject()->hasOverflowClip() && layer->layoutObject()->is Box()); | |
| 530 layer->convertToLayerCoords(paintOffsetBase, paintOffset, DeprecatedPaintLay er::ExcludeScroll); | |
| 531 LayerDescendantClipRecorder clipRecorder(context, *layer->layoutBox(), paint Offset); | |
| 532 #if ENABLE(ASSERT) | |
| 533 // We want to calculate the current layer position relative to the painting root. | |
| 534 // The conversion above reduces time complexity but is logically incorrect. | |
| 535 // For example if we have layers A, B, C where layer A is the grandparent of layer C, | |
| 536 // we want to first convert from space C->B then B->A. What we do above is a ctually | |
| 537 // convert from space B->A first then C->B. It works because we assume the c onversions | |
| 538 // are all linear translation thus commutative. | |
| 539 LayoutPoint expectedPaintOffset = toLayoutPoint(paintingInfo.subPixelAccumul ation); | |
| 540 layer->convertToLayerCoords(paintingInfo.rootLayer, expectedPaintOffset, Dep recatedPaintLayer::ExcludeScroll); | |
| 541 ASSERT(paintOffset == expectedPaintOffset); | |
| 542 #endif | |
| 543 | |
| 544 IntSize scrollOffset = layer->layoutBox()->scrolledContentOffset(); | |
| 545 Optional<ScrollRecorder> scrollRecorder; | |
| 546 if (layer->scrollsOverflow() || !scrollOffset.isZero()) | |
| 547 scrollRecorder.emplace(context, *layer->layoutObject(), PaintPhaseBlockB ackground, scrollOffset); | |
| 548 return recursivelyScrollAndPaintChildLayer(clippingAncestors, child, context , paintingInfo, paintFlags, layer, paintOffset); | |
| 549 } | |
| 550 | |
| 551 static void collectClippingLayersBetween(Vector<DeprecatedPaintLayer*> &clipping Ancestors, DeprecatedPaintLayer* layer, DeprecatedPaintLayer* ancestor) | |
|
chrishtr
2015/09/17 00:53:46
This function is doing almost (exactly?) the same
trchen
2015/09/17 01:56:04
Yep. Albeit we don't try to collapse clip rects ri
| |
| 552 { | |
| 553 while (layer && layer != ancestor) { | |
| 554 EPosition position = layer->layoutObject()->style()->position(); | |
| 555 ASSERT(position != FixedPosition); | |
| 556 | |
| 557 DeprecatedPaintLayer* container = nullptr; | |
| 558 if (position == AbsolutePosition) { | |
| 559 bool ranPastThisLayer; | |
| 560 container = layer->enclosingPositionedAncestor(ancestor, &ranPastThi sLayer); | |
| 561 if (ranPastThisLayer) | |
| 562 break; | |
| 563 } else { | |
| 564 container = layer->parent(); | |
| 565 } | |
| 566 if (!container) | |
| 567 break; | |
| 568 | |
| 569 if (container->layoutObject()->hasOverflowClip()) | |
|
chrishtr
2015/09/17 18:07:53
What about css clip and clip-path?
| |
| 570 clippingAncestors.append(container); | |
| 571 | |
| 572 layer = container; | |
| 573 } | |
| 574 } | |
| 575 | |
| 576 // TODO(trchen): Measure performance of this and implement display item de-dupin g if needed. | |
| 577 // For the pessimistic case this function will generate O(n^2) of clip/scroll pa irs, for example: | |
| 578 // <div style="overflow:scroll;"> * repeat 100 times | |
| 579 // <div style="position:relative;"></div> * repeat 100 times | |
| 580 // We will need to generate 100 clip/scroll pairs for each of the in-flow positi oned children. | |
| 581 DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintChild renWithFullScrollClipChain(unsigned childrenToVisit, GraphicsContext* context, c onst DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | |
|
chrishtr
2015/09/22 18:32:56
Let's implement an optimization here: between pain
| |
| 582 { | |
| 583 PaintResult result = FullyPainted; | |
| 584 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | |
| 585 | |
| 586 DeprecatedPaintLayerStackingNodeIterator iterator(*m_paintLayer.stackingNode (), childrenToVisit); | |
| 587 while (DeprecatedPaintLayerStackingNode* childNode = iterator.next()) { | |
| 588 DeprecatedPaintLayer* child = childNode->layer(); | |
| 589 EPosition childPosition = child->layoutObject()->style()->position(); | |
| 590 if (childPosition == FixedPosition) { | |
| 591 // TODO(trchen): Fixed position needs to be implemented here. | |
|
chrishtr
2015/09/17 18:07:53
We need a plan for how to do it before committing
chrishtr
2015/09/22 18:32:56
On reflection, I think fixed position shouldn't be
| |
| 592 if (DeprecatedPaintLayerPainter(*child).paintLayer(context, painting Info, paintFlags) == MaybeNotFullyPainted) | |
| 593 result = MaybeNotFullyPainted; | |
| 594 continue; | |
| 595 } | |
| 596 | |
| 597 Vector<DeprecatedPaintLayer*> clippingAncestors; | |
| 598 collectClippingLayersBetween(clippingAncestors, child, &m_paintLayer); | |
| 599 if (recursivelyScrollAndPaintChildLayer(clippingAncestors, *child, *cont ext, paintingInfo, paintFlags, paintingInfo.rootLayer, toLayoutPoint(paintingInf o.subPixelAccumulation)) == MaybeNotFullyPainted) | |
| 600 result = MaybeNotFullyPainted; | |
| 601 } | |
| 602 return result; | |
| 603 } | |
| 604 | |
| 502 // FIXME: inline this. | 605 // FIXME: inline this. |
| 503 static bool paintForFixedRootBackground(const DeprecatedPaintLayer* layer, Paint LayerFlags paintFlags) | 606 static bool paintForFixedRootBackground(const DeprecatedPaintLayer* layer, Paint LayerFlags paintFlags) |
| 504 { | 607 { |
| 505 return layer->layoutObject()->isDocumentElement() && (paintFlags & PaintLaye rPaintingRootBackgroundOnly); | 608 return layer->layoutObject()->isDocumentElement() && (paintFlags & PaintLaye rPaintingRootBackgroundOnly); |
| 506 } | 609 } |
| 507 | 610 |
| 508 bool DeprecatedPaintLayerPainter::shouldPaintLayerInSoftwareMode(const GlobalPai ntFlags globalPaintFlags, PaintLayerFlags paintFlags) | 611 bool DeprecatedPaintLayerPainter::shouldPaintLayerInSoftwareMode(const GlobalPai ntFlags globalPaintFlags, PaintLayerFlags paintFlags) |
| 509 { | 612 { |
| 510 DisableCompositingQueryAsserts disabler; | 613 DisableCompositingQueryAsserts disabler; |
| 511 | 614 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 529 clipRecorder.emplace(*context, *m_paintLayer.layoutObject(), Display Item::ClipLayerOverflowControls, fragment.backgroundRect, &localPaintingInfo, fr agment.paginationOffset, paintFlags); | 632 clipRecorder.emplace(*context, *m_paintLayer.layoutObject(), Display Item::ClipLayerOverflowControls, fragment.backgroundRect, &localPaintingInfo, fr agment.paginationOffset, paintFlags); |
| 530 if (DeprecatedPaintLayerScrollableArea* scrollableArea = m_paintLayer.sc rollableArea()) | 633 if (DeprecatedPaintLayerScrollableArea* scrollableArea = m_paintLayer.sc rollableArea()) |
| 531 ScrollableAreaPainter(*scrollableArea).paintOverflowControls(context , roundedIntPoint(toPoint(fragment.layerBounds.location() - m_paintLayer.layoutB oxLocation())), pixelSnappedIntRect(fragment.backgroundRect.rect()), true); | 634 ScrollableAreaPainter(*scrollableArea).paintOverflowControls(context , roundedIntPoint(toPoint(fragment.layerBounds.location() - m_paintLayer.layoutB oxLocation())), pixelSnappedIntRect(fragment.backgroundRect.rect()), true); |
| 532 } | 635 } |
| 533 } | 636 } |
| 534 | 637 |
| 535 void DeprecatedPaintLayerPainter::paintFragmentWithPhase(PaintPhase phase, const DeprecatedPaintLayerFragment& fragment, GraphicsContext* context, const ClipRec t& clipRect, const DeprecatedPaintLayerPaintingInfo& paintingInfo, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags, ClipState clipState) | 638 void DeprecatedPaintLayerPainter::paintFragmentWithPhase(PaintPhase phase, const DeprecatedPaintLayerFragment& fragment, GraphicsContext* context, const ClipRec t& clipRect, const DeprecatedPaintLayerPaintingInfo& paintingInfo, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags, ClipState clipState) |
| 536 { | 639 { |
| 537 ASSERT(m_paintLayer.isSelfPaintingLayer()); | 640 ASSERT(m_paintLayer.isSelfPaintingLayer()); |
| 538 | 641 |
| 642 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | |
| 643 PaintInfo paintInfo(context, enclosingIntRect(paintingInfo.paintDirtyRec t), phase, paintingInfo.globalPaintFlags(), paintFlags, paintingRootForLayoutObj ect, paintingInfo.rootLayer->layoutObject()); | |
| 644 LayoutPoint paintOffset = toPoint(fragment.layerBounds.location() - m_pa intLayer.layoutBoxLocation()); | |
| 645 m_paintLayer.layoutObject()->paint(paintInfo, paintOffset); | |
| 646 return; | |
| 647 } | |
| 648 | |
| 539 Optional<LayerClipRecorder> clipRecorder; | 649 Optional<LayerClipRecorder> clipRecorder; |
| 540 if (clipState != HasClipped && paintingInfo.clipToDirtyRect && needsToClip(p aintingInfo, clipRect)) { | 650 if (clipState != HasClipped && paintingInfo.clipToDirtyRect && needsToClip(p aintingInfo, clipRect)) { |
| 541 DisplayItem::Type clipType = DisplayItem::paintPhaseToClipLayerFragmentT ype(phase); | 651 DisplayItem::Type clipType = DisplayItem::paintPhaseToClipLayerFragmentT ype(phase); |
| 542 LayerClipRecorder::BorderRadiusClippingRule clippingRule; | 652 LayerClipRecorder::BorderRadiusClippingRule clippingRule; |
| 543 switch (phase) { | 653 switch (phase) { |
| 544 case PaintPhaseBlockBackground: // Background painting will handle clipp ing to self. | 654 case PaintPhaseBlockBackground: // Background painting will handle clipp ing to self. |
| 545 case PaintPhaseSelfOutline: | 655 case PaintPhaseSelfOutline: |
| 546 case PaintPhaseMask: // Mask painting will handle clipping to self. | 656 case PaintPhaseMask: // Mask painting will handle clipping to self. |
| 547 clippingRule = LayerClipRecorder::DoNotIncludeSelfForBorderRadius; | 657 clippingRule = LayerClipRecorder::DoNotIncludeSelfForBorderRadius; |
| 548 break; | 658 break; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 664 if (!m_paintLayer.containsDirtyOverlayScrollbars()) | 774 if (!m_paintLayer.containsDirtyOverlayScrollbars()) |
| 665 return; | 775 return; |
| 666 | 776 |
| 667 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); | 777 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot); |
| 668 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 778 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
| 669 | 779 |
| 670 m_paintLayer.setContainsDirtyOverlayScrollbars(false); | 780 m_paintLayer.setContainsDirtyOverlayScrollbars(false); |
| 671 } | 781 } |
| 672 | 782 |
| 673 } // namespace blink | 783 } // namespace blink |
| OLD | NEW |