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 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 if (PaintLayer* paintingLayer = this->paintingLayer()) | 1252 if (PaintLayer* paintingLayer = this->paintingLayer()) |
1253 paintingLayer->setNeedsRepaint(); | 1253 paintingLayer->setNeedsRepaint(); |
1254 } | 1254 } |
1255 | 1255 |
1256 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain
tInvalidationContainer, PaintInvalidationReason invalidationReason) const | 1256 void LayoutObject::invalidateDisplayItemClients(const LayoutBoxModelObject& pain
tInvalidationContainer, PaintInvalidationReason invalidationReason) const |
1257 { | 1257 { |
1258 // It's caller's responsibility to ensure enclosingSelfPaintingLayer's needs
Repaint is set. | 1258 // It's caller's responsibility to ensure enclosingSelfPaintingLayer's needs
Repaint is set. |
1259 // Don't set the flag here because getting enclosingSelfPaintLayer has cost
and the caller can use | 1259 // Don't set the flag here because getting enclosingSelfPaintLayer has cost
and the caller can use |
1260 // various ways (e.g. PaintInvalidatinState::enclosingSelfPaintingLayer()) t
o reduce the cost. | 1260 // various ways (e.g. PaintInvalidatinState::enclosingSelfPaintingLayer()) t
o reduce the cost. |
1261 ASSERT(!paintingLayer() || paintingLayer()->needsRepaint()); | 1261 ASSERT(!paintingLayer() || paintingLayer()->needsRepaint()); |
1262 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval
idationReason); | 1262 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this, inval
idationReason, this); |
1263 } | 1263 } |
1264 | 1264 |
1265 void LayoutObject::invalidateDisplayItemClientsWithPaintInvalidationState(const
LayoutBoxModelObject& paintInvalidationContainer, const PaintInvalidationState&
paintInvalidationState, PaintInvalidationReason invalidationReason) const | 1265 void LayoutObject::invalidateDisplayItemClientsWithPaintInvalidationState(const
LayoutBoxModelObject& paintInvalidationContainer, const PaintInvalidationState&
paintInvalidationState, PaintInvalidationReason invalidationReason) const |
1266 { | 1266 { |
1267 paintInvalidationState.paintingLayer().setNeedsRepaint(); | 1267 paintInvalidationState.paintingLayer().setNeedsRepaint(); |
1268 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason)
; | 1268 invalidateDisplayItemClients(paintInvalidationContainer, invalidationReason)
; |
1269 } | 1269 } |
1270 | 1270 |
1271 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const
LayoutRect& dirtyRect) const | 1271 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const
LayoutRect& dirtyRect) const |
1272 { | 1272 { |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1553 setPreviousPaintInvalidationRect(LayoutRect()); | 1553 setPreviousPaintInvalidationRect(LayoutRect()); |
1554 } | 1554 } |
1555 | 1555 |
1556 void LayoutObject::incrementallyInvalidatePaint(const LayoutBoxModelObject& pain
tInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds
, const LayoutPoint& positionFromPaintInvalidationBacking) | 1556 void LayoutObject::incrementallyInvalidatePaint(const LayoutBoxModelObject& pain
tInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds
, const LayoutPoint& positionFromPaintInvalidationBacking) |
1557 { | 1557 { |
1558 ASSERT(oldBounds.location() == newBounds.location()); | 1558 ASSERT(oldBounds.location() == newBounds.location()); |
1559 | 1559 |
1560 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); | 1560 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); |
1561 if (deltaRight > 0) { | 1561 if (deltaRight > 0) { |
1562 LayoutRect invalidationRect(oldBounds.maxX(), newBounds.y(), deltaRight,
newBounds.height()); | 1562 LayoutRect invalidationRect(oldBounds.maxX(), newBounds.y(), deltaRight,
newBounds.height()); |
1563 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInva
lidationContainer); | |
1564 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe
ct, PaintInvalidationIncremental); | 1563 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe
ct, PaintInvalidationIncremental); |
1565 } else if (deltaRight < 0) { | 1564 } else if (deltaRight < 0) { |
1566 LayoutRect invalidationRect(newBounds.maxX(), oldBounds.y(), -deltaRight
, oldBounds.height()); | 1565 LayoutRect invalidationRect(newBounds.maxX(), oldBounds.y(), -deltaRight
, oldBounds.height()); |
1567 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInva
lidationContainer); | |
1568 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe
ct, PaintInvalidationIncremental); | 1566 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe
ct, PaintInvalidationIncremental); |
1569 } | 1567 } |
1570 | 1568 |
1571 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); | 1569 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); |
1572 if (deltaBottom > 0) { | 1570 if (deltaBottom > 0) { |
1573 LayoutRect invalidationRect(newBounds.x(), oldBounds.maxY(), newBounds.w
idth(), deltaBottom); | 1571 LayoutRect invalidationRect(newBounds.x(), oldBounds.maxY(), newBounds.w
idth(), deltaBottom); |
1574 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInva
lidationContainer); | |
1575 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe
ct, PaintInvalidationIncremental); | 1572 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe
ct, PaintInvalidationIncremental); |
1576 } else if (deltaBottom < 0) { | 1573 } else if (deltaBottom < 0) { |
1577 LayoutRect invalidationRect(oldBounds.x(), newBounds.maxY(), oldBounds.w
idth(), -deltaBottom); | 1574 LayoutRect invalidationRect(oldBounds.x(), newBounds.maxY(), oldBounds.w
idth(), -deltaBottom); |
1578 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInva
lidationContainer); | |
1579 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe
ct, PaintInvalidationIncremental); | 1575 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe
ct, PaintInvalidationIncremental); |
1580 } | 1576 } |
1581 } | 1577 } |
1582 | 1578 |
1583 void LayoutObject::fullyInvalidatePaint(const LayoutBoxModelObject& paintInvalid
ationContainer, PaintInvalidationReason invalidationReason, const LayoutRect& ol
dBounds, const LayoutRect& newBounds) | 1579 void LayoutObject::fullyInvalidatePaint(const LayoutBoxModelObject& paintInvalid
ationContainer, PaintInvalidationReason invalidationReason, const LayoutRect& ol
dBounds, const LayoutRect& newBounds) |
1584 { | 1580 { |
1585 // The following logic avoids invalidating twice if one set of bounds contai
ns the other. | 1581 // The following logic avoids invalidating twice if one set of bounds contai
ns the other. |
1586 if (!newBounds.contains(oldBounds)) { | 1582 if (!newBounds.contains(oldBounds)) { |
1587 LayoutRect invalidationRect = oldBounds; | 1583 LayoutRect invalidationRect = oldBounds; |
1588 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInva
lidationContainer); | |
1589 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe
ct, invalidationReason); | 1584 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe
ct, invalidationReason); |
1590 | 1585 |
1591 if (oldBounds.contains(newBounds)) | 1586 if (oldBounds.contains(newBounds)) |
1592 return; | 1587 return; |
1593 } | 1588 } |
1594 | 1589 |
1595 LayoutRect invalidationRect = newBounds; | 1590 LayoutRect invalidationRect = newBounds; |
1596 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida
tionContainer); | |
1597 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect,
invalidationReason); | 1591 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect,
invalidationReason); |
1598 } | 1592 } |
1599 | 1593 |
1600 void LayoutObject::invalidatePaintForOverflow() | 1594 void LayoutObject::invalidatePaintForOverflow() |
1601 { | 1595 { |
1602 } | 1596 } |
1603 | 1597 |
1604 void LayoutObject::invalidatePaintForOverflowIfNeeded() | 1598 void LayoutObject::invalidatePaintForOverflowIfNeeded() |
1605 { | 1599 { |
1606 if (shouldInvalidateOverflowForPaint()) | 1600 if (shouldInvalidateOverflowForPaint()) |
(...skipping 1970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3577 // It's caller's responsibility to ensure enclosingSelfPaintingLayer's needs
Repaint is set. | 3571 // It's caller's responsibility to ensure enclosingSelfPaintingLayer's needs
Repaint is set. |
3578 // Don't set the flag here because getting enclosingSelfPaintLayer has cost
and the caller can use | 3572 // Don't set the flag here because getting enclosingSelfPaintLayer has cost
and the caller can use |
3579 // various ways (e.g. PaintInvalidatinState::enclosingSelfPaintingLayer()) t
o reduce the cost. | 3573 // various ways (e.g. PaintInvalidatinState::enclosingSelfPaintingLayer()) t
o reduce the cost. |
3580 ASSERT(!paintingLayer() || paintingLayer()->needsRepaint()); | 3574 ASSERT(!paintingLayer() || paintingLayer()->needsRepaint()); |
3581 | 3575 |
3582 // These disablers are valid because we want to use the current compositing/
invalidation status. | 3576 // These disablers are valid because we want to use the current compositing/
invalidation status. |
3583 DisablePaintInvalidationStateAsserts invalidationDisabler; | 3577 DisablePaintInvalidationStateAsserts invalidationDisabler; |
3584 DisableCompositingQueryAsserts compositingDisabler; | 3578 DisableCompositingQueryAsserts compositingDisabler; |
3585 | 3579 |
3586 LayoutRect invalidationRect = previousPaintInvalidationRect(); | 3580 LayoutRect invalidationRect = previousPaintInvalidationRect(); |
3587 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInvalida
tionContainer); | |
3588 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect,
reason); | 3581 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect,
reason); |
3589 invalidateDisplayItemClients(paintInvalidationContainer, reason); | 3582 invalidateDisplayItemClients(paintInvalidationContainer, reason); |
3590 | 3583 |
3591 // This method may be used to invalidate paint of an object changing paint i
nvalidation container. | 3584 // This method may be used to invalidate paint of an object changing paint i
nvalidation container. |
3592 // Clear previous paint invalidation rect on the original paint invalidation
container to avoid | 3585 // Clear previous paint invalidation rect on the original paint invalidation
container to avoid |
3593 // under-invalidation if the new paint invalidation rect on the new paint in
validation container | 3586 // under-invalidation if the new paint invalidation rect on the new paint in
validation container |
3594 // happens to be the same as the old one. | 3587 // happens to be the same as the old one. |
3595 clearPreviousPaintInvalidationRects(); | 3588 clearPreviousPaintInvalidationRects(); |
3596 } | 3589 } |
3597 | 3590 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3694 const blink::LayoutObject* root = object1; | 3687 const blink::LayoutObject* root = object1; |
3695 while (root->parent()) | 3688 while (root->parent()) |
3696 root = root->parent(); | 3689 root = root->parent(); |
3697 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3690 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3698 } else { | 3691 } else { |
3699 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3692 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3700 } | 3693 } |
3701 } | 3694 } |
3702 | 3695 |
3703 #endif | 3696 #endif |
OLD | NEW |