OLD | NEW |
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 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 return "invalidate paint"; | 1587 return "invalidate paint"; |
1588 case InvalidationPaintRectangle: | 1588 case InvalidationPaintRectangle: |
1589 return "invalidate paint rectangle"; | 1589 return "invalidate paint rectangle"; |
1590 } | 1590 } |
1591 ASSERT_NOT_REACHED(); | 1591 ASSERT_NOT_REACHED(); |
1592 return ""; | 1592 return ""; |
1593 } | 1593 } |
1594 | 1594 |
1595 void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv
alidationState) | 1595 void RenderObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv
alidationState) |
1596 { | 1596 { |
| 1597 ASSERT(!needsLayout()); |
| 1598 |
1597 // If we didn't need paint invalidation then our children don't need as well
. | 1599 // If we didn't need paint invalidation then our children don't need as well
. |
1598 // Skip walking down the tree as everything should be fine below us. | 1600 // Skip walking down the tree as everything should be fine below us. |
1599 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) | 1601 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) |
1600 return; | 1602 return; |
1601 | 1603 |
| 1604 invalidatePaintIfNeeded(paintInvalidationState, paintInvalidationState.paint
InvalidationContainer()); |
1602 clearPaintInvalidationState(paintInvalidationState); | 1605 clearPaintInvalidationState(paintInvalidationState); |
| 1606 invalidatePaintOfSubtreesIfNeeded(paintInvalidationState); |
| 1607 } |
1603 | 1608 |
| 1609 void RenderObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat
e& paintInvalidationState) |
| 1610 { |
1604 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { | 1611 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { |
1605 if (!child->isOutOfFlowPositioned()) | 1612 if (!child->isOutOfFlowPositioned()) |
1606 child->invalidateTreeIfNeeded(paintInvalidationState); | 1613 child->invalidateTreeIfNeeded(paintInvalidationState); |
1607 } | 1614 } |
1608 } | 1615 } |
1609 | 1616 |
1610 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe
cts(const LayoutRect& oldRect, const LayoutRect& newRect) | 1617 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe
cts(const LayoutRect& oldRect, const LayoutRect& newRect) |
1611 { | 1618 { |
1612 RefPtr<TracedValue> value = TracedValue::create(); | 1619 RefPtr<TracedValue> value = TracedValue::create(); |
1613 addJsonObjectForRect(value.get(), "old", oldRect); | 1620 addJsonObjectForRect(value.get(), "old", oldRect); |
1614 addJsonObjectForRect(value.get(), "new", newRect); | 1621 addJsonObjectForRect(value.get(), "new", newRect); |
1615 return value; | 1622 return value; |
1616 } | 1623 } |
1617 | 1624 |
1618 InvalidationReason RenderObject::invalidatePaintIfNeeded(const RenderLayerModelO
bject& paintInvalidationContainer, const LayoutRect& oldBounds, const LayoutPoin
t& oldLocation, const PaintInvalidationState& paintInvalidationState) | 1625 InvalidationReason RenderObject::invalidatePaintIfNeeded(const PaintInvalidation
State& paintInvalidationState, const RenderLayerModelObject& paintInvalidationCo
ntainer) |
1619 { | 1626 { |
1620 RenderView* v = view(); | 1627 RenderView* v = view(); |
1621 if (v->document().printing()) | 1628 if (v->document().printing()) |
1622 return InvalidationNone; // Don't invalidate paints if we're printing. | 1629 return InvalidationNone; // Don't invalidate paints if we're printing. |
1623 | 1630 |
1624 const LayoutRect& newBounds = previousPaintInvalidationRect(); | 1631 const LayoutRect oldBounds = previousPaintInvalidationRect(); |
1625 const LayoutPoint& newLocation = previousPositionFromPaintInvalidationContai
ner(); | 1632 const LayoutPoint oldLocation = previousPositionFromPaintInvalidationContain
er(); |
| 1633 const LayoutRect newBounds = boundsRectForPaintInvalidation(&paintInvalidati
onContainer, &paintInvalidationState); |
| 1634 const LayoutPoint newLocation = RenderLayer::positionFromPaintInvalidationCo
ntainer(this, &paintInvalidationContainer, &paintInvalidationState); |
| 1635 setPreviousPaintInvalidationRect(newBounds); |
| 1636 setPreviousPositionFromPaintInvalidationContainer(newLocation); |
1626 | 1637 |
1627 // FIXME: PaintInvalidationState should not be required here, but the call t
o flipForWritingMode | 1638 // If we are set to do a full paint invalidation that means the RenderView w
ill issue |
1628 // in mapRectToPaintInvalidationBacking will give us the wrong results with
it disabled. | 1639 // paint invalidations. We can then skip issuing of paint invalidations for
the child |
1629 // crbug.com/393762 | 1640 // renderers as they'll be covered by the RenderView. |
1630 ASSERT(newBounds == boundsRectForPaintInvalidation(&paintInvalidationContain
er, &paintInvalidationState)); | 1641 if (view()->doingFullPaintInvalidation()) |
| 1642 return InvalidationNone; |
1631 | 1643 |
1632 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintIfNeeded()", | 1644 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintIfNeeded()", |
1633 "object", this->debugName().ascii(), | 1645 "object", this->debugName().ascii(), |
1634 "info", jsonObjectForOldAndNewRects(oldBounds, newBounds)); | 1646 "info", jsonObjectForOldAndNewRects(oldBounds, newBounds)); |
1635 | 1647 |
1636 InvalidationReason invalidationReason = getPaintInvalidationReason(paintInva
lidationContainer, oldBounds, oldLocation, newBounds, newLocation); | 1648 InvalidationReason invalidationReason = getPaintInvalidationReason(paintInva
lidationContainer, oldBounds, oldLocation, newBounds, newLocation); |
1637 | 1649 |
1638 if (invalidationReason == InvalidationNone) | 1650 if (invalidationReason == InvalidationNone) |
1639 return invalidationReason; | 1651 return invalidationReason; |
1640 | 1652 |
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3446 { | 3458 { |
3447 if (object1) { | 3459 if (object1) { |
3448 const blink::RenderObject* root = object1; | 3460 const blink::RenderObject* root = object1; |
3449 while (root->parent()) | 3461 while (root->parent()) |
3450 root = root->parent(); | 3462 root = root->parent(); |
3451 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3463 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3452 } | 3464 } |
3453 } | 3465 } |
3454 | 3466 |
3455 #endif | 3467 #endif |
OLD | NEW |