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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 1804963005: Avoid paintInvalidationContainer parameter of invalidatePaintIfNeeded() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 bool LayoutBox::intersectsVisibleViewport() 1471 bool LayoutBox::intersectsVisibleViewport()
1472 { 1472 {
1473 LayoutRect rect = visualOverflowRect(); 1473 LayoutRect rect = visualOverflowRect();
1474 LayoutView* layoutView = view(); 1474 LayoutView* layoutView = view();
1475 while (layoutView->frame()->ownerLayoutObject()) 1475 while (layoutView->frame()->ownerLayoutObject())
1476 layoutView = layoutView->frame()->ownerLayoutObject()->view(); 1476 layoutView = layoutView->frame()->ownerLayoutObject()->view();
1477 mapToVisibleRectInAncestorSpace(layoutView, rect, nullptr); 1477 mapToVisibleRectInAncestorSpace(layoutView, rect, nullptr);
1478 return rect.intersects(LayoutRect(layoutView->frameView()->getScrollableArea ()->visibleContentRectDouble())); 1478 return rect.intersects(LayoutRect(layoutView->frameView()->getScrollableArea ()->visibleContentRectDouble()));
1479 } 1479 }
1480 1480
1481 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(PaintInvalidationStat e& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationContaine r) 1481 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(const PaintInvalidati onState& paintInvalidationState)
1482 { 1482 {
1483 PaintLayer& enclosingSelfPaintingLayer = paintInvalidationState.enclosingSel fPaintingLayer(*this); 1483 PaintLayer& enclosingSelfPaintingLayer = paintInvalidationState.enclosingSel fPaintingLayer(*this);
1484 if (enclosingSelfPaintingLayer.layoutObject() != this) { 1484 if (enclosingSelfPaintingLayer.layoutObject() != this) {
1485 if (isFloating()) 1485 if (isFloating())
1486 enclosingSelfPaintingLayer.setNeedsPaintPhaseFloat(); 1486 enclosingSelfPaintingLayer.setNeedsPaintPhaseFloat();
1487 1487
1488 if (hasBoxDecorationBackground() 1488 if (hasBoxDecorationBackground()
1489 // We also paint overflow controls in background phase. 1489 // We also paint overflow controls in background phase.
1490 || (hasOverflowClip() && getScrollableArea()->hasOverflowControls()) ) 1490 || (hasOverflowClip() && getScrollableArea()->hasOverflowControls()) )
1491 enclosingSelfPaintingLayer.setNeedsPaintPhaseDescendantBlockBackgrou nds(); 1491 enclosingSelfPaintingLayer.setNeedsPaintPhaseDescendantBlockBackgrou nds();
1492 } 1492 }
1493 1493
1494 PaintInvalidationReason fullInvalidationReason = fullPaintInvalidationReason (); 1494 PaintInvalidationReason fullInvalidationReason = fullPaintInvalidationReason ();
1495 // If the current paint invalidation reason is PaintInvalidationDelayedFull, then this paint invalidation can delayed if the 1495 // If the current paint invalidation reason is PaintInvalidationDelayedFull, then this paint invalidation can delayed if the
1496 // LayoutBox in question is not on-screen. The logic to decide whether this is appropriate exists at the site of the original 1496 // LayoutBox in question is not on-screen. The logic to decide whether this is appropriate exists at the site of the original
1497 // paint invalidation that chose PaintInvalidationDelayedFull. 1497 // paint invalidation that chose PaintInvalidationDelayedFull.
1498 if (fullInvalidationReason == PaintInvalidationDelayedFull) { 1498 if (fullInvalidationReason == PaintInvalidationDelayedFull) {
1499 if (!intersectsVisibleViewport()) 1499 if (!intersectsVisibleViewport())
1500 return PaintInvalidationDelayedFull; 1500 return PaintInvalidationDelayedFull;
1501 1501
1502 // Reset state back to regular full paint invalidation if the object is onscreen. 1502 // Reset state back to regular full paint invalidation if the object is onscreen.
1503 setShouldDoFullPaintInvalidation(PaintInvalidationFull); 1503 setShouldDoFullPaintInvalidation(PaintInvalidationFull);
1504 } 1504 }
1505 1505
1506 PaintInvalidationReason reason = LayoutBoxModelObject::invalidatePaintIfNeed ed(paintInvalidationState, paintInvalidationContainer); 1506 PaintInvalidationReason reason = LayoutBoxModelObject::invalidatePaintIfNeed ed(paintInvalidationState);
1507 1507
1508 if (!view()->doingFullPaintInvalidation() && !isFullPaintInvalidationReason( reason)) 1508 if (!view()->doingFullPaintInvalidation() && !isFullPaintInvalidationReason( reason))
1509 invalidatePaintForOverflowIfNeeded(); 1509 invalidatePaintForOverflowIfNeeded();
1510 1510
1511 if (PaintLayerScrollableArea* area = getScrollableArea()) 1511 if (PaintLayerScrollableArea* area = getScrollableArea())
1512 area->invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState, pa intInvalidationContainer); 1512 area->invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState);
1513 1513
1514 // This is for the next invalidatePaintIfNeeded so must be at the end. 1514 // This is for the next invalidatePaintIfNeeded so must be at the end.
1515 savePreviousBoxSizesIfNeeded(); 1515 savePreviousBoxSizesIfNeeded();
1516 return reason; 1516 return reason;
1517 } 1517 }
1518 1518
1519 void LayoutBox::invalidatePaintOfSubtreesIfNeeded(PaintInvalidationState& childP aintInvalidationState) 1519 void LayoutBox::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationState& childPaintInvalidationState)
1520 { 1520 {
1521 LayoutBoxModelObject::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidati onState); 1521 LayoutBoxModelObject::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidati onState);
1522 1522
1523 if (PaintLayer* layer = this->layer()) { 1523 if (PaintLayer* layer = this->layer()) {
1524 if (PaintLayerReflectionInfo* reflectionInfo = layer->reflectionInfo()) 1524 if (PaintLayerReflectionInfo* reflectionInfo = layer->reflectionInfo())
1525 reflectionInfo->reflection()->invalidateTreeIfNeeded(childPaintInval idationState); 1525 reflectionInfo->reflection()->invalidateTreeIfNeeded(childPaintInval idationState);
1526 } 1526 }
1527 } 1527 }
1528 1528
1529 LayoutRect LayoutBox::overflowClipRect(const LayoutPoint& location, OverlayScrol lbarSizeRelevancy relevancy) const 1529 LayoutRect LayoutBox::overflowClipRect(const LayoutPoint& location, OverlayScrol lbarSizeRelevancy relevancy) const
(...skipping 3183 matching lines...) Expand 10 before | Expand all | Expand 10 after
4713 4713
4714 void LayoutBox::clearPercentHeightDescendants() 4714 void LayoutBox::clearPercentHeightDescendants()
4715 { 4715 {
4716 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { 4716 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) {
4717 if (curr->isBox()) 4717 if (curr->isBox())
4718 toLayoutBox(curr)->removeFromPercentHeightContainer(); 4718 toLayoutBox(curr)->removeFromPercentHeightContainer();
4719 } 4719 }
4720 } 4720 }
4721 4721
4722 } // namespace blink 4722 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698