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