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 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // If we didn't need paint invalidation then our children don't need as well
. | 1605 // 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. | 1606 // Skip walking down the tree as everything should be fine below us. |
1607 if (!shouldCheckForPaintInvalidation()) | 1607 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) |
1608 return; | 1608 return; |
1609 | 1609 |
1610 clearPaintInvalidationState(); | 1610 clearPaintInvalidationState(paintInvalidationState); |
1611 | 1611 |
1612 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { | 1612 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { |
1613 if (!child->isOutOfFlowPositioned()) | 1613 if (!child->isOutOfFlowPositioned()) |
1614 child->invalidateTreeIfNeeded(paintInvalidationState); | 1614 child->invalidateTreeIfNeeded(paintInvalidationState); |
1615 } | 1615 } |
1616 } | 1616 } |
1617 | 1617 |
1618 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe
cts(const LayoutRect& oldRect, const LayoutRect& newRect) | 1618 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe
cts(const LayoutRect& oldRect, const LayoutRect& newRect) |
1619 { | 1619 { |
1620 RefPtr<TracedValue> value = TracedValue::create(); | 1620 RefPtr<TracedValue> value = TracedValue::create(); |
1621 addJsonObjectForRect(value.get(), "old", oldRect); | 1621 addJsonObjectForRect(value.get(), "old", oldRect); |
1622 addJsonObjectForRect(value.get(), "new", newRect); | 1622 addJsonObjectForRect(value.get(), "new", newRect); |
1623 return value; | 1623 return value; |
1624 } | 1624 } |
1625 | 1625 |
1626 bool RenderObject::invalidatePaintIfNeeded(const RenderLayerModelObject& paintIn
validationContainer, const LayoutRect& oldBounds, const LayoutPoint& oldLocation
, const PaintInvalidationState& paintInvalidationState) | 1626 InvalidationReason RenderObject::invalidatePaintIfNeeded(const RenderLayerModelO
bject& paintInvalidationContainer, const LayoutRect& oldBounds, const LayoutPoin
t& oldLocation, const PaintInvalidationState& paintInvalidationState) |
1627 { | 1627 { |
1628 RenderView* v = view(); | 1628 RenderView* v = view(); |
1629 if (v->document().printing()) | 1629 if (v->document().printing()) |
1630 return false; // Don't invalidate paints if we're printing. | 1630 return InvalidationNone; // Don't invalidate paints if we're printing. |
1631 | 1631 |
1632 const LayoutRect& newBounds = previousPaintInvalidationRect(); | 1632 const LayoutRect& newBounds = previousPaintInvalidationRect(); |
1633 const LayoutPoint& newLocation = previousPositionFromPaintInvalidationContai
ner(); | 1633 const LayoutPoint& newLocation = previousPositionFromPaintInvalidationContai
ner(); |
1634 | 1634 |
1635 // FIXME: PaintInvalidationState should not be required here, but the call t
o flipForWritingMode | 1635 // FIXME: PaintInvalidationState should not be required here, but the call t
o flipForWritingMode |
1636 // in mapRectToPaintInvalidationBacking will give us the wrong results with
it disabled. | 1636 // in mapRectToPaintInvalidationBacking will give us the wrong results with
it disabled. |
1637 // crbug.com/393762 | 1637 // crbug.com/393762 |
1638 ASSERT(newBounds == boundsRectForPaintInvalidation(&paintInvalidationContain
er, &paintInvalidationState)); | 1638 ASSERT(newBounds == boundsRectForPaintInvalidation(&paintInvalidationContain
er, &paintInvalidationState)); |
1639 | 1639 |
1640 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintIfNeeded()", | 1640 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintIfNeeded()", |
1641 "object", this->debugName().ascii(), | 1641 "object", this->debugName().ascii(), |
1642 "info", jsonObjectForOldAndNewRects(oldBounds, newBounds)); | 1642 "info", jsonObjectForOldAndNewRects(oldBounds, newBounds)); |
1643 | 1643 |
1644 InvalidationReason invalidationReason = getPaintInvalidationReason(paintInva
lidationContainer, oldBounds, oldLocation, newBounds, newLocation); | 1644 InvalidationReason invalidationReason = getPaintInvalidationReason(paintInva
lidationContainer, oldBounds, oldLocation, newBounds, newLocation); |
1645 | 1645 |
1646 if (invalidationReason == InvalidationNone) | 1646 if (invalidationReason == InvalidationNone) |
1647 return false; | 1647 return invalidationReason; |
1648 | 1648 |
1649 if (invalidationReason == InvalidationIncremental) { | 1649 if (invalidationReason == InvalidationIncremental) { |
1650 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds); | 1650 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds); |
1651 return false; | 1651 return invalidationReason; |
1652 } | 1652 } |
1653 | 1653 |
1654 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun
ds, newBounds); | 1654 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, oldBoun
ds, newBounds); |
1655 return true; | 1655 return invalidationReason; |
1656 } | 1656 } |
1657 | 1657 |
1658 InvalidationReason RenderObject::getPaintInvalidationReason(const RenderLayerMod
elObject& paintInvalidationContainer, | 1658 InvalidationReason RenderObject::getPaintInvalidationReason(const RenderLayerMod
elObject& paintInvalidationContainer, |
1659 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t& newBounds, const LayoutPoint& newLocation) | 1659 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t& newBounds, const LayoutPoint& newLocation) |
1660 { | 1660 { |
1661 if (shouldDoFullPaintInvalidation()) | 1661 if (shouldDoFullPaintInvalidation()) |
1662 return InvalidationFull; | 1662 return InvalidationFull; |
1663 | 1663 |
1664 // Presumably a background or a border exists if border-fit:lines was specif
ied. | 1664 // Presumably a background or a border exists if border-fit:lines was specif
ied. |
1665 if (style()->borderFit() == BorderFitLines) | 1665 if (style()->borderFit() == BorderFitLines) |
(...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3392 { | 3392 { |
3393 ASSERT_NOT_REACHED(); | 3393 ASSERT_NOT_REACHED(); |
3394 return false; | 3394 return false; |
3395 } | 3395 } |
3396 | 3396 |
3397 bool RenderObject::isRelayoutBoundaryForInspector() const | 3397 bool RenderObject::isRelayoutBoundaryForInspector() const |
3398 { | 3398 { |
3399 return objectIsRelayoutBoundary(this); | 3399 return objectIsRelayoutBoundary(this); |
3400 } | 3400 } |
3401 | 3401 |
3402 void RenderObject::clearPaintInvalidationState() | 3402 void RenderObject::clearPaintInvalidationState(const PaintInvalidationState& pai
ntInvalidationState) |
3403 { | 3403 { |
3404 // paintInvalidationStateIsDirty should be kept in sync with the | 3404 // paintInvalidationStateIsDirty should be kept in sync with the |
3405 // booleans that are cleared below. | 3405 // booleans that are cleared below. |
3406 ASSERT(paintInvalidationStateIsDirty()); | 3406 ASSERT(paintInvalidationState.forceCheckForPaintInvalidation() || paintInval
idationStateIsDirty()); |
3407 setShouldDoFullPaintInvalidation(false); | 3407 setShouldDoFullPaintInvalidation(false); |
3408 setShouldDoFullPaintInvalidationIfSelfPaintingLayer(false); | 3408 setShouldDoFullPaintInvalidationIfSelfPaintingLayer(false); |
3409 setOnlyNeededPositionedMovementLayout(false); | 3409 setOnlyNeededPositionedMovementLayout(false); |
3410 setNeededLayoutBecauseOfChildren(false); | 3410 setNeededLayoutBecauseOfChildren(false); |
3411 setShouldInvalidateOverflowForPaint(false); | 3411 setShouldInvalidateOverflowForPaint(false); |
3412 setLayoutDidGetCalled(false); | 3412 setLayoutDidGetCalled(false); |
3413 setMayNeedPaintInvalidation(false); | 3413 setMayNeedPaintInvalidation(false); |
3414 } | 3414 } |
3415 | 3415 |
3416 bool RenderObject::isAllowedToModifyRenderTreeStructure(Document& document) | 3416 bool RenderObject::isAllowedToModifyRenderTreeStructure(Document& document) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3454 { | 3454 { |
3455 if (object1) { | 3455 if (object1) { |
3456 const blink::RenderObject* root = object1; | 3456 const blink::RenderObject* root = object1; |
3457 while (root->parent()) | 3457 while (root->parent()) |
3458 root = root->parent(); | 3458 root = root->parent(); |
3459 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3459 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3460 } | 3460 } |
3461 } | 3461 } |
3462 | 3462 |
3463 #endif | 3463 #endif |
OLD | NEW |