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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 1813383002: Move all fast-path paint invalidation mapping into PaintInvalidationState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reorganize conditions in PaintInvalidationState constructor Created 4 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 } 536 }
537 537
538 void PaintLayer::clearPaginationRecursive() 538 void PaintLayer::clearPaginationRecursive()
539 { 539 {
540 if (m_rareData) 540 if (m_rareData)
541 m_rareData->enclosingPaginationLayer = nullptr; 541 m_rareData->enclosingPaginationLayer = nullptr;
542 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) 542 for (PaintLayer* child = firstChild(); child; child = child->nextSibling())
543 child->clearPaginationRecursive(); 543 child->clearPaginationRecursive();
544 } 544 }
545 545
546 LayoutPoint PaintLayer::positionFromPaintInvalidationBacking(const LayoutObject* layoutObject, const LayoutBoxModelObject* paintInvalidationContainer, const Pai ntInvalidationState* paintInvalidationState) 546 void PaintLayer::mapPointInPaintInvalidationContainerToBacking(const LayoutBoxMo delObject& paintInvalidationContainer, FloatPoint& point)
547 { 547 {
548 FloatPoint point = layoutObject->localToAncestorPoint(FloatPoint(), paintInv alidationContainer, 0, 0, paintInvalidationState); 548 PaintLayer* paintInvalidationLayer = paintInvalidationContainer.layer();
549
550 // FIXME: Eventually we are going to unify coordinates in GraphicsLayer spac e.
551 if (paintInvalidationContainer && paintInvalidationContainer->layer()->group edMapping())
552 mapPointToPaintBackingCoordinates(paintInvalidationContainer, point);
553
554 return LayoutPoint(point);
555 }
556
557 void PaintLayer::mapPointToPaintBackingCoordinates(const LayoutBoxModelObject* p aintInvalidationContainer, FloatPoint& point)
558 {
559 PaintLayer* paintInvalidationLayer = paintInvalidationContainer->layer();
560 if (!paintInvalidationLayer->groupedMapping()) { 549 if (!paintInvalidationLayer->groupedMapping()) {
561 point.move(paintInvalidationLayer->compositedLayerMapping()->contentOffs etInCompositingLayer()); 550 point.move(paintInvalidationLayer->compositedLayerMapping()->contentOffs etInCompositingLayer());
562 return; 551 return;
563 } 552 }
564 553
565 LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosin gTransformedAncestor()->layoutObject(); 554 LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosin gTransformedAncestor()->layoutObject();
566 if (!transformedAncestor) 555 if (!transformedAncestor)
567 return; 556 return;
568 557
569 // |paintInvalidationContainer| may have a local 2D transform on it, so take that into account when mapping into the space of the 558 // |paintInvalidationContainer| may have a local 2D transform on it, so take that into account when mapping into the space of the
570 // transformed ancestor. 559 // transformed ancestor.
571 point = paintInvalidationContainer->localToAncestorPoint(point, transformedA ncestor); 560 point = paintInvalidationContainer.localToAncestorPoint(point, transformedAn cestor);
572 561
573 point.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromT ransformedAncestor()); 562 point.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromT ransformedAncestor());
574 } 563 }
575 564
576 void PaintLayer::mapRectToPaintBackingCoordinates(const LayoutBoxModelObject* pa intInvalidationContainer, LayoutRect& rect) 565 void PaintLayer::mapRectInPaintInvalidationContainerToBacking(const LayoutBoxMod elObject& paintInvalidationContainer, LayoutRect& rect)
577 { 566 {
578 PaintLayer* paintInvalidationLayer = paintInvalidationContainer->layer(); 567 PaintLayer* paintInvalidationLayer = paintInvalidationContainer.layer();
579 if (!paintInvalidationLayer->groupedMapping()) { 568 if (!paintInvalidationLayer->groupedMapping()) {
580 rect.move(paintInvalidationLayer->compositedLayerMapping()->contentOffse tInCompositingLayer()); 569 rect.move(paintInvalidationLayer->compositedLayerMapping()->contentOffse tInCompositingLayer());
581 return; 570 return;
582 } 571 }
583 572
584 LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosin gTransformedAncestor()->layoutObject(); 573 LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosin gTransformedAncestor()->layoutObject();
585 if (!transformedAncestor) 574 if (!transformedAncestor)
586 return; 575 return;
587 576
588 // |paintInvalidationContainer| may have a local 2D transform on it, so take that into account when mapping into the space of the 577 // |paintInvalidationContainer| may have a local 2D transform on it, so take that into account when mapping into the space of the
589 // transformed ancestor. 578 // transformed ancestor.
590 rect = LayoutRect(paintInvalidationContainer->localToAncestorQuad(FloatRect( rect), transformedAncestor).boundingBox()); 579 rect = LayoutRect(paintInvalidationContainer.localToAncestorQuad(FloatRect(r ect), transformedAncestor).boundingBox());
591 580
592 rect.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromTr ansformedAncestor()); 581 rect.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromTr ansformedAncestor());
593 } 582 }
594 583
595 void PaintLayer::mapRectToPaintInvalidationBacking(const LayoutObject* layoutObj ect, const LayoutBoxModelObject* paintInvalidationContainer, LayoutRect& rect, c onst PaintInvalidationState* paintInvalidationState) 584 void PaintLayer::mapRectToPaintInvalidationBacking(const LayoutObject& layoutObj ect, const LayoutBoxModelObject& paintInvalidationContainer, LayoutRect& rect)
596 { 585 {
597 if (!paintInvalidationContainer->layer()->groupedMapping()) { 586 if (!paintInvalidationContainer.layer()->groupedMapping()) {
598 layoutObject->mapToVisibleRectInAncestorSpace(paintInvalidationContainer , rect, paintInvalidationState); 587 layoutObject.mapToVisibleRectInAncestorSpace(&paintInvalidationContainer , rect);
599 return; 588 return;
600 } 589 }
601 590
602 // This code adjusts the paint invalidation rectangle to be in the space of the transformed ancestor of the grouped (i.e. squashed) 591 // This code adjusts the paint invalidation rectangle to be in the space of the transformed ancestor of the grouped (i.e. squashed)
603 // layer. This is because all layers that squash together need to issue pain t invalidations w.r.t. a single container that is 592 // layer. This is because all layers that squash together need to issue pain t invalidations w.r.t. a single container that is
604 // an ancestor of all of them, in order to properly take into account any lo cal transforms etc. 593 // an ancestor of all of them, in order to properly take into account any lo cal transforms etc.
605 // FIXME: remove this special-case code that works around the paint invalida tion code structure. 594 // FIXME: remove this special-case code that works around the paint invalida tion code structure.
606 layoutObject->mapToVisibleRectInAncestorSpace(paintInvalidationContainer, re ct, paintInvalidationState); 595 layoutObject.mapToVisibleRectInAncestorSpace(&paintInvalidationContainer, re ct);
607 596
608 mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect); 597 mapRectInPaintInvalidationContainerToBacking(paintInvalidationContainer, rec t);
609 }
610
611 LayoutRect PaintLayer::computePaintInvalidationRect(const LayoutObject& layoutOb ject, const PaintLayer* paintInvalidationContainer, const PaintInvalidationState * paintInvalidationState)
612 {
613 if (!paintInvalidationContainer->groupedMapping())
614 return layoutObject.computePaintInvalidationRect(*paintInvalidationConta iner->layoutObject(), paintInvalidationState);
615
616 LayoutRect rect = layoutObject.clippedOverflowRectForPaintInvalidation(paint InvalidationContainer->layoutObject(), paintInvalidationState);
617 mapRectToPaintBackingCoordinates(paintInvalidationContainer->layoutObject(), rect);
618 return rect;
619 } 598 }
620 599
621 void PaintLayer::dirtyVisibleContentStatus() 600 void PaintLayer::dirtyVisibleContentStatus()
622 { 601 {
623 compositor()->setNeedsUpdateDescendantDependentFlags(); 602 compositor()->setNeedsUpdateDescendantDependentFlags();
624 m_visibleContentStatusDirty = true; 603 m_visibleContentStatusDirty = true;
625 if (parent()) 604 if (parent())
626 parent()->dirtyAncestorChainVisibleDescendantStatus(); 605 parent()->dirtyAncestorChainVisibleDescendantStatus();
627 // Non-self-painting layers paint into their ancestor layer, and count as pa rt of the "visible contents" of the parent, so we need to dirty it. 606 // Non-self-painting layers paint into their ancestor layer, and count as pa rt of the "visible contents" of the parent, so we need to dirty it.
628 if (!isSelfPaintingLayer()) 607 if (!isSelfPaintingLayer())
(...skipping 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2835 2814
2836 void showLayerTree(const blink::LayoutObject* layoutObject) 2815 void showLayerTree(const blink::LayoutObject* layoutObject)
2837 { 2816 {
2838 if (!layoutObject) { 2817 if (!layoutObject) {
2839 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); 2818 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
2840 return; 2819 return;
2841 } 2820 }
2842 showLayerTree(layoutObject->enclosingLayer()); 2821 showLayerTree(layoutObject->enclosingLayer());
2843 } 2822 }
2844 #endif 2823 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698