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

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

Issue 1159113003: [SP] Don't invalidate the whole scrolled tree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: NeedsRebaselines (see previous try result); Comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/TestExpectations ('k') | Source/core/paint/DeprecatedPaintLayerPaintingInfo.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 416
417 void DeprecatedPaintLayerPainter::paintChildren(unsigned childrenToVisit, Graphi csContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintL ayerFlags paintFlags) 417 void DeprecatedPaintLayerPainter::paintChildren(unsigned childrenToVisit, Graphi csContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintL ayerFlags paintFlags)
418 { 418 {
419 if (!m_paintLayer.hasSelfPaintingLayerDescendant()) 419 if (!m_paintLayer.hasSelfPaintingLayerDescendant())
420 return; 420 return;
421 421
422 #if ENABLE(ASSERT) 422 #if ENABLE(ASSERT)
423 LayerListMutationDetector mutationChecker(m_paintLayer.stackingNode()); 423 LayerListMutationDetector mutationChecker(m_paintLayer.stackingNode());
424 #endif 424 #endif
425 425
426 IntSize scrollOffsetAccumulation = paintingInfo.scrollOffsetAccumulation;
427 if (m_paintLayer.layoutObject()->hasOverflowClip())
428 scrollOffsetAccumulation += m_paintLayer.layoutBox()->scrolledContentOff set();
429
426 DeprecatedPaintLayerStackingNodeIterator iterator(*m_paintLayer.stackingNode (), childrenToVisit); 430 DeprecatedPaintLayerStackingNodeIterator iterator(*m_paintLayer.stackingNode (), childrenToVisit);
427 while (DeprecatedPaintLayerStackingNode* child = iterator.next()) { 431 while (DeprecatedPaintLayerStackingNode* child = iterator.next()) {
428 DeprecatedPaintLayerPainter childPainter(*child->layer()); 432 DeprecatedPaintLayerPainter childPainter(*child->layer());
429 // If this Layer should paint into its own backing or a grouped backing, that will be done via CompositedDeprecatedPaintLayerMapping::paintContents() 433 // If this Layer should paint into its own backing or a grouped backing, that will be done via CompositedDeprecatedPaintLayerMapping::paintContents()
430 // and CompositedDeprecatedPaintLayerMapping::doPaintTask(). 434 // and CompositedDeprecatedPaintLayerMapping::doPaintTask().
431 if (!childPainter.shouldPaintLayerInSoftwareMode(paintingInfo, paintFlag s)) 435 if (!childPainter.shouldPaintLayerInSoftwareMode(paintingInfo, paintFlag s))
432 continue; 436 continue;
433 437
438 DeprecatedPaintLayerPaintingInfo childPaintingInfo = paintingInfo;
439 childPaintingInfo.scrollOffsetAccumulation = scrollOffsetAccumulation;
440 // Rare case: accumulate scroll offset of non-stacking-context ancestors up to m_paintLayer.
441 for (DeprecatedPaintLayer* parentLayer = child->layer()->parent(); paren tLayer != &m_paintLayer; parentLayer = parentLayer->parent()) {
442 if (parentLayer->layoutObject()->hasOverflowClip())
443 childPaintingInfo.scrollOffsetAccumulation += parentLayer->layou tBox()->scrolledContentOffset();
444 }
445
434 if (!child->layer()->isPaginated()) 446 if (!child->layer()->isPaginated())
435 childPainter.paintLayer(context, paintingInfo, paintFlags); 447 childPainter.paintLayer(context, childPaintingInfo, paintFlags);
436 else 448 else
437 childPainter.paintPaginatedChildLayer(context, paintingInfo, paintFl ags); 449 childPainter.paintPaginatedChildLayer(context, childPaintingInfo, pa intFlags);
438 } 450 }
439 } 451 }
440 452
441 // FIXME: inline this. 453 // FIXME: inline this.
442 static bool paintForFixedRootBackground(const DeprecatedPaintLayer* layer, Paint LayerFlags paintFlags) 454 static bool paintForFixedRootBackground(const DeprecatedPaintLayer* layer, Paint LayerFlags paintFlags)
443 { 455 {
444 return layer->layoutObject()->isDocumentElement() && (paintFlags & PaintLaye rPaintingRootBackgroundOnly); 456 return layer->layoutObject()->isDocumentElement() && (paintFlags & PaintLaye rPaintingRootBackgroundOnly);
445 } 457 }
446 458
447 bool DeprecatedPaintLayerPainter::shouldPaintLayerInSoftwareMode(const Deprecate dPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 459 bool DeprecatedPaintLayerPainter::shouldPaintLayerInSoftwareMode(const Deprecate dPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 clippingRule = LayerClipRecorder::IncludeSelfForBorderRadius; 638 clippingRule = LayerClipRecorder::IncludeSelfForBorderRadius;
627 break; 639 break;
628 } 640 }
629 641
630 clipRecorder.emplace(*context, *m_paintLayer.layoutObject(), clipType, c lipRect, &paintingInfo, fragment.paginationOffset, paintFlags, clippingRule); 642 clipRecorder.emplace(*context, *m_paintLayer.layoutObject(), clipType, c lipRect, &paintingInfo, fragment.paginationOffset, paintFlags, clippingRule);
631 } 643 }
632 644
633 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa intBehavior, paintingRootForLayoutObject, 0, paintingInfo.rootLayer->layoutObjec t()); 645 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa intBehavior, paintingRootForLayoutObject, 0, paintingInfo.rootLayer->layoutObjec t());
634 OwnPtr<ScrollRecorder> scrollRecorder; 646 OwnPtr<ScrollRecorder> scrollRecorder;
635 LayoutPoint paintOffset = toPoint(fragment.layerBounds.location() - m_paintL ayer.layoutBoxLocation()); 647 LayoutPoint paintOffset = toPoint(fragment.layerBounds.location() - m_paintL ayer.layoutBoxLocation());
636 if (&m_paintLayer != paintingInfo.rootLayer && paintingInfo.rootLayer->layou tObject()->hasOverflowClip()) { 648 if (!paintingInfo.scrollOffsetAccumulation.isZero()) {
637 // As a sublayer of the root layer, m_paintLayer's painting is not contr olled by the ScrollRecorder 649 // As a descendant of the root layer, m_paintLayer's painting is not con trolled by the ScrollRecorders
638 // created by BlockPainter of the root layer, so we need to issue Scroll Recorder for them separately. 650 // created by BlockPainter of the ancestor layers up to the root layer, so we need to issue ScrollRecorder
639 // FIXME: This doesn't apply in slimming paint phase 2. 651 // for this layer seperately, with the scroll offset accumulated from th e root layer to the parent of this
640 IntSize scrollOffset = paintingInfo.rootLayer->layoutBox()->scrolledCont entOffset(); 652 // layer, to get the same result as ScrollRecorder in BlockPainter.
641 if (paintingInfo.rootLayer->scrollsOverflow() || !scrollOffset.isZero()) { 653 paintOffset += paintingInfo.scrollOffsetAccumulation;
642 paintOffset += scrollOffset; 654 paintInfo.rect.move(paintingInfo.scrollOffsetAccumulation);
643 paintInfo.rect.move(scrollOffset); 655 scrollRecorder = adoptPtr(new ScrollRecorder(*paintInfo.context, *m_pain tLayer.layoutObject(), paintInfo.phase, paintingInfo.scrollOffsetAccumulation));
644 scrollRecorder = adoptPtr(new ScrollRecorder(*paintInfo.context, *m_ paintLayer.layoutObject(), paintInfo.phase, scrollOffset));
645 }
646 } 656 }
647 m_paintLayer.layoutObject()->paint(paintInfo, paintOffset); 657 m_paintLayer.layoutObject()->paint(paintInfo, paintOffset);
648 } 658 }
649 659
650 void DeprecatedPaintLayerPainter::paintBackgroundForFragments(const DeprecatedPa intLayerFragments& layerFragments, GraphicsContext* context, 660 void DeprecatedPaintLayerPainter::paintBackgroundForFragments(const DeprecatedPa intLayerFragments& layerFragments, GraphicsContext* context,
651 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayerPain tingInfo& localPaintingInfo, PaintBehavior paintBehavior, 661 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayerPain tingInfo& localPaintingInfo, PaintBehavior paintBehavior,
652 LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags) 662 LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags)
653 { 663 {
654 bool needsScope = layerFragments.size() > 1; 664 bool needsScope = layerFragments.size() > 1;
655 for (auto& fragment : layerFragments) { 665 for (auto& fragment : layerFragments) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 if (!m_paintLayer.containsDirtyOverlayScrollbars()) 752 if (!m_paintLayer.containsDirtyOverlayScrollbars())
743 return; 753 return;
744 754
745 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), paintBehavior, LayoutSize(), paintingRoot); 755 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), paintBehavior, LayoutSize(), paintingRoot);
746 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 756 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
747 757
748 m_paintLayer.setContainsDirtyOverlayScrollbars(false); 758 m_paintLayer.setContainsDirtyOverlayScrollbars(false);
749 } 759 }
750 760
751 } // namespace blink 761 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | Source/core/paint/DeprecatedPaintLayerPaintingInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698