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

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

Issue 535633002: Common invalidateTreeIfNeeded() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address Dan's comments Created 6 years, 3 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) 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 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 return "invalidate paint"; 1595 return "invalidate paint";
1596 case InvalidationPaintRectangle: 1596 case InvalidationPaintRectangle:
1597 return "invalidate paint rectangle"; 1597 return "invalidate paint rectangle";
1598 } 1598 }
1599 ASSERT_NOT_REACHED(); 1599 ASSERT_NOT_REACHED();
1600 return ""; 1600 return "";
1601 } 1601 }
1602 1602
1603 void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState) 1603 void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState)
1604 { 1604 {
1605 ASSERT(!needsLayout());
1606
1605 // If we didn't need paint invalidation then our children don't need as well . 1607 // If we didn't need paint invalidation then our children don't need as well .
1606 // Skip walking down the tree as everything should be fine below us. 1608 // Skip walking down the tree as everything should be fine below us.
1607 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) 1609 if (!shouldCheckForPaintInvalidation(paintInvalidationState))
1608 return; 1610 return;
1609 1611
1612 invalidatePaintIfNeeded(paintInvalidationState, paintInvalidationState.paint InvalidationContainer());
1610 clearPaintInvalidationState(paintInvalidationState); 1613 clearPaintInvalidationState(paintInvalidationState);
1614 invalidatePaintOfSubtreesIfNeeded(paintInvalidationState);
1615 }
1611 1616
1617 void RenderObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat e& paintInvalidationState)
1618 {
1612 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { 1619 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli ng()) {
1613 if (!child->isOutOfFlowPositioned()) 1620 if (!child->isOutOfFlowPositioned())
1614 child->invalidateTreeIfNeeded(paintInvalidationState); 1621 child->invalidateTreeIfNeeded(paintInvalidationState);
1615 } 1622 }
1616 } 1623 }
1617 1624
1618 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe cts(const LayoutRect& oldRect, const LayoutRect& newRect) 1625 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe cts(const LayoutRect& oldRect, const LayoutRect& newRect)
1619 { 1626 {
1620 RefPtr<TracedValue> value = TracedValue::create(); 1627 RefPtr<TracedValue> value = TracedValue::create();
1621 addJsonObjectForRect(value.get(), "old", oldRect); 1628 addJsonObjectForRect(value.get(), "old", oldRect);
1622 addJsonObjectForRect(value.get(), "new", newRect); 1629 addJsonObjectForRect(value.get(), "new", newRect);
1623 return value; 1630 return value;
1624 } 1631 }
1625 1632
1626 InvalidationReason RenderObject::invalidatePaintIfNeeded(const RenderLayerModelO bject& paintInvalidationContainer, const LayoutRect& oldBounds, const LayoutPoin t& oldLocation, const PaintInvalidationState& paintInvalidationState) 1633 InvalidationReason RenderObject::invalidatePaintIfNeeded(const PaintInvalidation State& paintInvalidationState, const RenderLayerModelObject& paintInvalidationCo ntainer)
1627 { 1634 {
1628 RenderView* v = view(); 1635 RenderView* v = view();
1629 if (v->document().printing()) 1636 if (v->document().printing())
1630 return InvalidationNone; // Don't invalidate paints if we're printing. 1637 return InvalidationNone; // Don't invalidate paints if we're printing.
1631 1638
1632 const LayoutRect& newBounds = previousPaintInvalidationRect(); 1639 const LayoutRect oldBounds = previousPaintInvalidationRect();
1633 const LayoutPoint& newLocation = previousPositionFromPaintInvalidationContai ner(); 1640 const LayoutPoint oldLocation = previousPositionFromPaintInvalidationContain er();
1641 const LayoutRect newBounds = boundsRectForPaintInvalidation(&paintInvalidati onContainer, &paintInvalidationState);
1642 const LayoutPoint newLocation = RenderLayer::positionFromPaintInvalidationCo ntainer(this, &paintInvalidationContainer, &paintInvalidationState);
1643 setPreviousPaintInvalidationRect(newBounds);
1644 setPreviousPositionFromPaintInvalidationContainer(newLocation);
1634 1645
1635 // FIXME: PaintInvalidationState should not be required here, but the call t o flipForWritingMode 1646 // FIXME: The call to flipForWritingMode in mapRectToPaintInvalidationBackin g
1636 // in mapRectToPaintInvalidationBacking will give us the wrong results with it disabled. 1647 // will give us the wrong results without paintInvalidationState.
1637 // crbug.com/393762 1648 // crbug.com/393762
1638 ASSERT(newBounds == boundsRectForPaintInvalidation(&paintInvalidationContain er, &paintInvalidationState)); 1649 // ASSERT(newBounds == boundsRectForPaintInvalidation(&newPaintInvalidationC ontainer, 0));
Julien - ping for review 2014/09/04 19:48:04 The ASSERT should use paintInvalidationContainer a
leviw_travelin_and_unemployed 2014/09/05 21:37:12 Why newPaintInvalidationContainer? That's not actu
Xianzhu 2014/09/05 22:06:37 I removed it.
1650
1651 // If we are set to do a full paint invalidation that means the RenderView w ill issue
1652 // paint invalidations. We can then skip issuing of paint invalidations for the child
1653 // renderers as they'll be covered by the RenderView.
1654 if (view()->doingFullPaintInvalidation())
1655 return InvalidationNone;
1639 1656
1640 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject: :invalidatePaintIfNeeded()", 1657 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject: :invalidatePaintIfNeeded()",
1641 "object", this->debugName().ascii(), 1658 "object", this->debugName().ascii(),
1642 "info", jsonObjectForOldAndNewRects(oldBounds, newBounds)); 1659 "info", jsonObjectForOldAndNewRects(oldBounds, newBounds));
1643 1660
1644 InvalidationReason invalidationReason = getPaintInvalidationReason(paintInva lidationContainer, oldBounds, oldLocation, newBounds, newLocation); 1661 InvalidationReason invalidationReason = getPaintInvalidationReason(paintInva lidationContainer, oldBounds, oldLocation, newBounds, newLocation);
1645 1662
1646 if (invalidationReason == InvalidationNone) 1663 if (invalidationReason == InvalidationNone)
1647 return invalidationReason; 1664 return invalidationReason;
1648 1665
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after
3454 { 3471 {
3455 if (object1) { 3472 if (object1) {
3456 const blink::RenderObject* root = object1; 3473 const blink::RenderObject* root = object1;
3457 while (root->parent()) 3474 while (root->parent())
3458 root = root->parent(); 3475 root = root->parent();
3459 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3476 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3460 } 3477 }
3461 } 3478 }
3462 3479
3463 #endif 3480 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698