| 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 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 template<typename T> void addJsonObjectForRect(TracedValue& value, const char* n
ame, const T& rect) | 1457 template<typename T> void addJsonObjectForRect(TracedValue& value, const char* n
ame, const T& rect) |
| 1458 { | 1458 { |
| 1459 value.beginDictionary(name) | 1459 value.beginDictionary(name) |
| 1460 .setDouble("x", rect.x()) | 1460 .setDouble("x", rect.x()) |
| 1461 .setDouble("y", rect.y()) | 1461 .setDouble("y", rect.y()) |
| 1462 .setDouble("width", rect.width()) | 1462 .setDouble("width", rect.width()) |
| 1463 .setDouble("height", rect.height()) | 1463 .setDouble("height", rect.height()) |
| 1464 .endDictionary(); | 1464 .endDictionary(); |
| 1465 } | 1465 } |
| 1466 | 1466 |
| 1467 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForPaintInvali
dationInfo(const IntRect& rect, const String& invalidationReason) | 1467 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForPaintInvali
dationInfo(const LayoutRect& rect, const String& invalidationReason) |
| 1468 { | 1468 { |
| 1469 TracedValue value; | 1469 TracedValue value; |
| 1470 addJsonObjectForRect(value, "rect", rect); | 1470 addJsonObjectForRect(value, "rect", rect); |
| 1471 value.setString("invalidation_reason", invalidationReason); | 1471 value.setString("invalidation_reason", invalidationReason); |
| 1472 return value.finish(); | 1472 return value.finish(); |
| 1473 } | 1473 } |
| 1474 | 1474 |
| 1475 LayoutRect RenderObject::computePaintInvalidationRect(const RenderLayerModelObje
ct* paintInvalidationContainer) const | 1475 LayoutRect RenderObject::computePaintInvalidationRect(const RenderLayerModelObje
ct* paintInvalidationContainer) const |
| 1476 { | 1476 { |
| 1477 return clippedOverflowRectForPaintInvalidation(paintInvalidationContainer); | 1477 return clippedOverflowRectForPaintInvalidation(paintInvalidationContainer); |
| 1478 } | 1478 } |
| 1479 | 1479 |
| 1480 void RenderObject::invalidatePaintUsingContainer(const RenderLayerModelObject* p
aintInvalidationContainer, const IntRect& r, InvalidationReason invalidationReas
on) const | 1480 void RenderObject::invalidatePaintUsingContainer(const RenderLayerModelObject* p
aintInvalidationContainer, const LayoutRect& r, InvalidationReason invalidationR
eason) const |
| 1481 { | 1481 { |
| 1482 if (r.isEmpty()) | 1482 if (r.isEmpty()) |
| 1483 return; | 1483 return; |
| 1484 | 1484 |
| 1485 // FIXME: This should be an assert, but editing/selection can trigger this c
ase to invalidate | 1485 // FIXME: This should be an assert, but editing/selection can trigger this c
ase to invalidate |
| 1486 // the selection. crbug.com/368140. | 1486 // the selection. crbug.com/368140. |
| 1487 if (!isRooted()) | 1487 if (!isRooted()) |
| 1488 return; | 1488 return; |
| 1489 | 1489 |
| 1490 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintUsingContainer()", | 1490 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintUsingContainer()", |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1523 return; | 1523 return; |
| 1524 | 1524 |
| 1525 if (view()->document().printing()) | 1525 if (view()->document().printing()) |
| 1526 return; // Don't invalidate paints if we're printing. | 1526 return; // Don't invalidate paints if we're printing. |
| 1527 | 1527 |
| 1528 // FIXME: really, we're in the paint invalidation phase here, and the follow
ing queries are legal. | 1528 // FIXME: really, we're in the paint invalidation phase here, and the follow
ing queries are legal. |
| 1529 // Until those states are fully fledged, I'll just disable the ASSERTS. | 1529 // Until those states are fully fledged, I'll just disable the ASSERTS. |
| 1530 DisableCompositingQueryAsserts disabler; | 1530 DisableCompositingQueryAsserts disabler; |
| 1531 const RenderLayerModelObject* paintInvalidationContainer = containerForPaint
Invalidation(); | 1531 const RenderLayerModelObject* paintInvalidationContainer = containerForPaint
Invalidation(); |
| 1532 LayoutRect paintInvalidationRect = boundsRectForPaintInvalidation(paintInval
idationContainer); | 1532 LayoutRect paintInvalidationRect = boundsRectForPaintInvalidation(paintInval
idationContainer); |
| 1533 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRec
t(paintInvalidationRect), InvalidationPaint); | 1533 invalidatePaintUsingContainer(paintInvalidationContainer, paintInvalidationR
ect, InvalidationPaint); |
| 1534 } | 1534 } |
| 1535 | 1535 |
| 1536 LayoutRect RenderObject::boundsRectForPaintInvalidation(const RenderLayerModelOb
ject* paintInvalidationContainer) const | 1536 LayoutRect RenderObject::boundsRectForPaintInvalidation(const RenderLayerModelOb
ject* paintInvalidationContainer) const |
| 1537 { | 1537 { |
| 1538 if (!paintInvalidationContainer) | 1538 if (!paintInvalidationContainer) |
| 1539 return computePaintInvalidationRect(paintInvalidationContainer); | 1539 return computePaintInvalidationRect(paintInvalidationContainer); |
| 1540 return RenderLayer::computePaintInvalidationRect(this, paintInvalidationCont
ainer->layer()); | 1540 return RenderLayer::computePaintInvalidationRect(this, paintInvalidationCont
ainer->layer()); |
| 1541 } | 1541 } |
| 1542 | 1542 |
| 1543 void RenderObject::invalidatePaintRectangle(const LayoutRect& r) const | 1543 void RenderObject::invalidatePaintRectangle(const LayoutRect& r) const |
| 1544 { | 1544 { |
| 1545 if (!isRooted()) | 1545 if (!isRooted()) |
| 1546 return; | 1546 return; |
| 1547 | 1547 |
| 1548 if (view()->document().printing()) | 1548 if (view()->document().printing()) |
| 1549 return; // Don't invalidate paints if we're printing. | 1549 return; // Don't invalidate paints if we're printing. |
| 1550 | 1550 |
| 1551 LayoutRect dirtyRect(r); | 1551 LayoutRect dirtyRect(r); |
| 1552 | 1552 |
| 1553 const RenderLayerModelObject* paintInvalidationContainer = containerForPaint
Invalidation(); | 1553 const RenderLayerModelObject* paintInvalidationContainer = containerForPaint
Invalidation(); |
| 1554 RenderLayer::mapRectToPaintInvalidationBacking(this, paintInvalidationContai
ner, dirtyRect); | 1554 RenderLayer::mapRectToPaintInvalidationBacking(this, paintInvalidationContai
ner, dirtyRect); |
| 1555 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRec
t(dirtyRect), InvalidationPaintRectangle); | 1555 invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, Invalid
ationPaintRectangle); |
| 1556 } | 1556 } |
| 1557 | 1557 |
| 1558 IntRect RenderObject::pixelSnappedAbsoluteClippedOverflowRect() const | 1558 IntRect RenderObject::pixelSnappedAbsoluteClippedOverflowRect() const |
| 1559 { | 1559 { |
| 1560 return pixelSnappedIntRect(absoluteClippedOverflowRect()); | 1560 return pixelSnappedIntRect(absoluteClippedOverflowRect()); |
| 1561 } | 1561 } |
| 1562 | 1562 |
| 1563 const char* RenderObject::invalidationReasonToString(InvalidationReason reason)
const | 1563 const char* RenderObject::invalidationReasonToString(InvalidationReason reason)
const |
| 1564 { | 1564 { |
| 1565 switch (reason) { | 1565 switch (reason) { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); | 1693 ASSERT(paintInvalidationContainer); |
| 1694 | 1694 |
| 1695 ASSERT(oldBounds.location() == newBounds.location()); | 1695 ASSERT(oldBounds.location() == newBounds.location()); |
| 1696 | 1696 |
| 1697 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); | 1697 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); |
| 1698 if (deltaRight > 0) | 1698 if (deltaRight > 0) |
| 1699 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()), Invalida
tionIncremental); | 1699 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(old
Bounds.maxX(), newBounds.y(), deltaRight, newBounds.height()), InvalidationIncre
mental); |
| 1700 else if (deltaRight < 0) | 1700 else if (deltaRight < 0) |
| 1701 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()), Invalid
ationIncremental); | 1701 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(new
Bounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()), InvalidationIncr
emental); |
| 1702 | 1702 |
| 1703 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); | 1703 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); |
| 1704 if (deltaBottom > 0) | 1704 if (deltaBottom > 0) |
| 1705 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom), Invalida
tionIncremental); | 1705 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(new
Bounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom), InvalidationIncre
mental); |
| 1706 else if (deltaBottom < 0) | 1706 else if (deltaBottom < 0) |
| 1707 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom), Invalid
ationIncremental); | 1707 invalidatePaintUsingContainer(paintInvalidationContainer, LayoutRect(old
Bounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom), InvalidationIncr
emental); |
| 1708 } | 1708 } |
| 1709 | 1709 |
| 1710 void RenderObject::fullyInvalidatePaint(const RenderLayerModelObject* paintInval
idationContainer, InvalidationReason invalidationReason, const LayoutRect& oldBo
unds, const LayoutRect& newBounds) | 1710 void RenderObject::fullyInvalidatePaint(const RenderLayerModelObject* paintInval
idationContainer, InvalidationReason invalidationReason, const LayoutRect& oldBo
unds, const LayoutRect& newBounds) |
| 1711 { | 1711 { |
| 1712 // Otherwise do full paint invalidation. | 1712 // Otherwise do full paint invalidation. |
| 1713 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRec
t(oldBounds), invalidationReason); | 1713 invalidatePaintUsingContainer(paintInvalidationContainer, oldBounds, invalid
ationReason); |
| 1714 if (newBounds != oldBounds) | 1714 if (newBounds != oldBounds) |
| 1715 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(newBounds), invalidationReason); | 1715 invalidatePaintUsingContainer(paintInvalidationContainer, newBounds, inv
alidationReason); |
| 1716 } | 1716 } |
| 1717 | 1717 |
| 1718 void RenderObject::invalidatePaintForOverflow() | 1718 void RenderObject::invalidatePaintForOverflow() |
| 1719 { | 1719 { |
| 1720 } | 1720 } |
| 1721 | 1721 |
| 1722 void RenderObject::invalidatePaintForOverflowIfNeeded() | 1722 void RenderObject::invalidatePaintForOverflowIfNeeded() |
| 1723 { | 1723 { |
| 1724 if (shouldInvalidateOverflowForPaint()) | 1724 if (shouldInvalidateOverflowForPaint()) |
| 1725 invalidatePaintForOverflow(); | 1725 invalidatePaintForOverflow(); |
| (...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3452 { | 3452 { |
| 3453 if (object1) { | 3453 if (object1) { |
| 3454 const WebCore::RenderObject* root = object1; | 3454 const WebCore::RenderObject* root = object1; |
| 3455 while (root->parent()) | 3455 while (root->parent()) |
| 3456 root = root->parent(); | 3456 root = root->parent(); |
| 3457 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3457 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 3458 } | 3458 } |
| 3459 } | 3459 } |
| 3460 | 3460 |
| 3461 #endif | 3461 #endif |
| OLD | NEW |