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

Side by Side Diff: Source/core/rendering/RenderObject.cpp

Issue 374833007: Use reference for paintInvalidationContainer param of invalidatePaintIfNeeded (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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
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) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 } 1612 }
1613 1613
1614 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe cts(const LayoutRect& oldRect, const LayoutRect& newRect) 1614 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe cts(const LayoutRect& oldRect, const LayoutRect& newRect)
1615 { 1615 {
1616 TracedValue value; 1616 TracedValue value;
1617 addJsonObjectForRect(value, "old", oldRect); 1617 addJsonObjectForRect(value, "old", oldRect);
1618 addJsonObjectForRect(value, "new", newRect); 1618 addJsonObjectForRect(value, "new", newRect);
1619 return value.finish(); 1619 return value.finish();
1620 } 1620 }
1621 1621
1622 bool RenderObject::invalidatePaintIfNeeded(const RenderLayerModelObject* paintIn validationContainer, const LayoutRect& oldBounds, const LayoutPoint& oldLocation ) 1622 bool RenderObject::invalidatePaintIfNeeded(const RenderLayerModelObject& paintIn validationContainer, const LayoutRect& oldBounds, const LayoutPoint& oldLocation )
1623 { 1623 {
1624 RenderView* v = view(); 1624 RenderView* v = view();
1625 if (v->document().printing()) 1625 if (v->document().printing())
1626 return false; // Don't invalidate paints if we're printing. 1626 return false; // Don't invalidate paints if we're printing.
1627 1627
1628 const LayoutRect& newBounds = previousPaintInvalidationRect(); 1628 const LayoutRect& newBounds = previousPaintInvalidationRect();
1629 const LayoutPoint& newLocation = previousPositionFromPaintInvalidationContai ner(); 1629 const LayoutPoint& newLocation = previousPositionFromPaintInvalidationContai ner();
1630 1630
1631 ASSERT(newBounds == boundsRectForPaintInvalidation(paintInvalidationContaine r)); 1631 ASSERT(newBounds == boundsRectForPaintInvalidation(&paintInvalidationContain er));
1632 1632
1633 // FIXME: This should use a ConvertableToTraceFormat when they are available in Blink. 1633 // FIXME: This should use a ConvertableToTraceFormat when they are available in Blink.
1634 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject: :invalidatePaintIfNeeded()", 1634 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject: :invalidatePaintIfNeeded()",
1635 "object", this->debugName().ascii(), 1635 "object", this->debugName().ascii(),
1636 "info", jsonObjectForOldAndNewRects(oldBounds, newBounds)); 1636 "info", jsonObjectForOldAndNewRects(oldBounds, newBounds));
1637 1637
1638 InvalidationReason invalidationReason = getPaintInvalidationReason(paintInva lidationContainer, oldBounds, oldLocation, newBounds, newLocation); 1638 InvalidationReason invalidationReason = getPaintInvalidationReason(paintInva lidationContainer, oldBounds, oldLocation, newBounds, newLocation);
1639 1639
1640 if (invalidationReason == InvalidationNone) 1640 if (invalidationReason == InvalidationNone)
1641 return false; 1641 return false;
1642 1642
1643 if (invalidationReason == InvalidationIncremental) { 1643 if (invalidationReason == InvalidationIncremental) {
1644 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds); 1644 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB ounds);
1645 return false; 1645 return false;
1646 } 1646 }
1647 1647
1648 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds); 1648 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun ds, newBounds);
1649 return true; 1649 return true;
1650 } 1650 }
1651 1651
1652 InvalidationReason RenderObject::getPaintInvalidationReason(const RenderLayerMod elObject* paintInvalidationContainer, 1652 InvalidationReason RenderObject::getPaintInvalidationReason(const RenderLayerMod elObject& paintInvalidationContainer,
1653 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec t& newBounds, const LayoutPoint& newLocation) 1653 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec t& newBounds, const LayoutPoint& newLocation)
1654 { 1654 {
1655 if (shouldDoFullPaintInvalidationAfterLayout()) 1655 if (shouldDoFullPaintInvalidationAfterLayout())
1656 return InvalidationFull; 1656 return InvalidationFull;
1657 1657
1658 // Presumably a background or a border exists if border-fit:lines was specif ied. 1658 // Presumably a background or a border exists if border-fit:lines was specif ied.
1659 if (style()->borderFit() == BorderFitLines) 1659 if (style()->borderFit() == BorderFitLines)
1660 return InvalidationBorderFitLines; 1660 return InvalidationBorderFitLines;
1661 1661
1662 if (compositingState() != PaintsIntoOwnBacking && newLocation != oldLocation ) 1662 if (compositingState() != PaintsIntoOwnBacking && newLocation != oldLocation )
(...skipping 20 matching lines...) Expand all
1683 // This covers the case where we mark containing blocks for layout 1683 // This covers the case where we mark containing blocks for layout
1684 // and they change size but don't have anything to paint. This is 1684 // and they change size but don't have anything to paint. This is
1685 // a pretty common case for <body> as we add / remove children 1685 // a pretty common case for <body> as we add / remove children
1686 // (and the default background is done by FrameView). 1686 // (and the default background is done by FrameView).
1687 if (skipInvalidationWhenLaidOutChildren() && !mayNeedPaintInvalidation()) 1687 if (skipInvalidationWhenLaidOutChildren() && !mayNeedPaintInvalidation())
1688 return InvalidationNone; 1688 return InvalidationNone;
1689 1689
1690 return InvalidationIncremental; 1690 return InvalidationIncremental;
1691 } 1691 }
1692 1692
1693 void RenderObject::incrementallyInvalidatePaint(const RenderLayerModelObject* pa intInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBoun ds) 1693 void RenderObject::incrementallyInvalidatePaint(const RenderLayerModelObject& pa intInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBoun ds)
1694 { 1694 {
1695 ASSERT(paintInvalidationContainer);
1696
1697 ASSERT(oldBounds.location() == newBounds.location()); 1695 ASSERT(oldBounds.location() == newBounds.location());
1698 1696
1699 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); 1697 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX();
1700 if (deltaRight > 0) 1698 if (deltaRight > 0)
1701 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(old Bounds.maxX(), newBounds.y(), deltaRight, newBounds.height()), InvalidationIncre mental); 1699 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ol dBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()), InvalidationIncr emental);
1702 else if (deltaRight < 0) 1700 else if (deltaRight < 0)
1703 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(new Bounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()), InvalidationIncr emental); 1701 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ne wBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()), InvalidationInc remental);
1704 1702
1705 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); 1703 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY();
1706 if (deltaBottom > 0) 1704 if (deltaBottom > 0)
1707 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(new Bounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom), InvalidationIncre mental); 1705 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ne wBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom), InvalidationIncr emental);
1708 else if (deltaBottom < 0) 1706 else if (deltaBottom < 0)
1709 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(old Bounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom), InvalidationIncr emental); 1707 invalidatePaintUsingContainer(&paintInvalidationContainer, LayoutRect(ol dBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom), InvalidationInc remental);
1710 } 1708 }
1711 1709
1712 void RenderObject::fullyInvalidatePaint(const RenderLayerModelObject* paintInval idationContainer, InvalidationReason invalidationReason, const LayoutRect& oldBo unds, const LayoutRect& newBounds) 1710 void RenderObject::fullyInvalidatePaint(const RenderLayerModelObject& paintInval idationContainer, InvalidationReason invalidationReason, const LayoutRect& oldBo unds, const LayoutRect& newBounds)
1713 { 1711 {
1714 // Otherwise do full paint invalidation. 1712 // Otherwise do full paint invalidation.
1715 invalidatePaintUsingContainer(paintInvalidationContainer, oldBounds, invalid ationReason); 1713 invalidatePaintUsingContainer(&paintInvalidationContainer, oldBounds, invali dationReason);
1716 if (newBounds != oldBounds) 1714 if (newBounds != oldBounds)
1717 invalidatePaintUsingContainer(paintInvalidationContainer, newBounds, inv alidationReason); 1715 invalidatePaintUsingContainer(&paintInvalidationContainer, newBounds, in validationReason);
1718 } 1716 }
1719 1717
1720 void RenderObject::invalidatePaintForOverflow() 1718 void RenderObject::invalidatePaintForOverflow()
1721 { 1719 {
1722 } 1720 }
1723 1721
1724 void RenderObject::invalidatePaintForOverflowIfNeeded() 1722 void RenderObject::invalidatePaintForOverflowIfNeeded()
1725 { 1723 {
1726 if (shouldInvalidateOverflowForPaint()) 1724 if (shouldInvalidateOverflowForPaint())
1727 invalidatePaintForOverflow(); 1725 invalidatePaintForOverflow();
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after
3447 { 3445 {
3448 if (object1) { 3446 if (object1) {
3449 const WebCore::RenderObject* root = object1; 3447 const WebCore::RenderObject* root = object1;
3450 while (root->parent()) 3448 while (root->parent())
3451 root = root->parent(); 3449 root = root->parent();
3452 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3450 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3453 } 3451 }
3454 } 3452 }
3455 3453
3456 #endif 3454 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698