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 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 void addJsonObjectForRect(TracedValue* value, const char* name, const T& rect) | 1458 void addJsonObjectForRect(TracedValue* value, const char* name, const T& rect) |
1459 { | 1459 { |
1460 value->beginDictionary(name); | 1460 value->beginDictionary(name); |
1461 value->setDouble("x", rect.x()); | 1461 value->setDouble("x", rect.x()); |
1462 value->setDouble("y", rect.y()); | 1462 value->setDouble("y", rect.y()); |
1463 value->setDouble("width", rect.width()); | 1463 value->setDouble("width", rect.width()); |
1464 value->setDouble("height", rect.height()); | 1464 value->setDouble("height", rect.height()); |
1465 value->endDictionary(); | 1465 value->endDictionary(); |
1466 } | 1466 } |
1467 | 1467 |
| 1468 template <typename T> |
| 1469 void addJsonObjectForPoint(TracedValue* value, const char* name, const T& point) |
| 1470 { |
| 1471 value->beginDictionary(name); |
| 1472 value->setDouble("x", point.x()); |
| 1473 value->setDouble("y", point.y()); |
| 1474 value->endDictionary(); |
| 1475 } |
| 1476 |
1468 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForPaintInvali
dationInfo(const LayoutRect& rect, const String& invalidationReason) | 1477 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForPaintInvali
dationInfo(const LayoutRect& rect, const String& invalidationReason) |
1469 { | 1478 { |
1470 RefPtr<TracedValue> value = TracedValue::create(); | 1479 RefPtr<TracedValue> value = TracedValue::create(); |
1471 addJsonObjectForRect(value.get(), "rect", rect); | 1480 addJsonObjectForRect(value.get(), "rect", rect); |
1472 value->setString("invalidation_reason", invalidationReason); | 1481 value->setString("invalidation_reason", invalidationReason); |
1473 return value; | 1482 return value; |
1474 } | 1483 } |
1475 | 1484 |
1476 LayoutRect RenderObject::computePaintInvalidationRect(const RenderLayerModelObje
ct* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS
tate) const | 1485 LayoutRect RenderObject::computePaintInvalidationRect(const RenderLayerModelObje
ct* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationS
tate) const |
1477 { | 1486 { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1604 } | 1613 } |
1605 | 1614 |
1606 void RenderObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat
e& paintInvalidationState) | 1615 void RenderObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat
e& paintInvalidationState) |
1607 { | 1616 { |
1608 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { | 1617 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { |
1609 if (!child->isOutOfFlowPositioned()) | 1618 if (!child->isOutOfFlowPositioned()) |
1610 child->invalidateTreeIfNeeded(paintInvalidationState); | 1619 child->invalidateTreeIfNeeded(paintInvalidationState); |
1611 } | 1620 } |
1612 } | 1621 } |
1613 | 1622 |
1614 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe
cts(const LayoutRect& oldRect, const LayoutRect& newRect) | 1623 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe
cts(const LayoutRect& oldRect, const LayoutPoint& oldLocation, const LayoutRect&
newRect, const LayoutPoint& newLocation) |
1615 { | 1624 { |
1616 RefPtr<TracedValue> value = TracedValue::create(); | 1625 RefPtr<TracedValue> value = TracedValue::create(); |
1617 addJsonObjectForRect(value.get(), "old", oldRect); | 1626 addJsonObjectForRect(value.get(), "oldRect", oldRect); |
1618 addJsonObjectForRect(value.get(), "new", newRect); | 1627 addJsonObjectForPoint(value.get(), "oldLocation", oldLocation); |
| 1628 addJsonObjectForRect(value.get(), "newRect", newRect); |
| 1629 addJsonObjectForPoint(value.get(), "newLocation", newLocation); |
1619 return value; | 1630 return value; |
1620 } | 1631 } |
1621 | 1632 |
1622 InvalidationReason RenderObject::invalidatePaintIfNeeded(const PaintInvalidation
State& paintInvalidationState, const RenderLayerModelObject& paintInvalidationCo
ntainer) | 1633 InvalidationReason RenderObject::invalidatePaintIfNeeded(const PaintInvalidation
State& paintInvalidationState, const RenderLayerModelObject& paintInvalidationCo
ntainer) |
1623 { | 1634 { |
1624 RenderView* v = view(); | 1635 RenderView* v = view(); |
1625 if (v->document().printing()) | 1636 if (v->document().printing()) |
1626 return InvalidationNone; // Don't invalidate paints if we're printing. | 1637 return InvalidationNone; // Don't invalidate paints if we're printing. |
1627 | 1638 |
1628 const LayoutRect oldBounds = previousPaintInvalidationRect(); | 1639 const LayoutRect oldBounds = previousPaintInvalidationRect(); |
1629 const LayoutPoint oldLocation = previousPositionFromPaintInvalidationContain
er(); | 1640 const LayoutPoint oldLocation = previousPositionFromPaintInvalidationContain
er(); |
1630 const LayoutRect newBounds = boundsRectForPaintInvalidation(&paintInvalidati
onContainer, &paintInvalidationState); | 1641 const LayoutRect newBounds = boundsRectForPaintInvalidation(&paintInvalidati
onContainer, &paintInvalidationState); |
1631 const LayoutPoint newLocation = RenderLayer::positionFromPaintInvalidationCo
ntainer(this, &paintInvalidationContainer, &paintInvalidationState); | 1642 const LayoutPoint newLocation = RenderLayer::positionFromPaintInvalidationCo
ntainer(this, &paintInvalidationContainer, &paintInvalidationState); |
1632 setPreviousPaintInvalidationRect(newBounds); | 1643 setPreviousPaintInvalidationRect(newBounds); |
1633 setPreviousPositionFromPaintInvalidationContainer(newLocation); | 1644 setPreviousPositionFromPaintInvalidationContainer(newLocation); |
1634 | 1645 |
1635 // If we are set to do a full paint invalidation that means the RenderView w
ill issue | 1646 // If we are set to do a full paint invalidation that means the RenderView w
ill issue |
1636 // paint invalidations. We can then skip issuing of paint invalidations for
the child | 1647 // paint invalidations. We can then skip issuing of paint invalidations for
the child |
1637 // renderers as they'll be covered by the RenderView. | 1648 // renderers as they'll be covered by the RenderView. |
1638 if (view()->doingFullPaintInvalidation()) | 1649 if (view()->doingFullPaintInvalidation()) |
1639 return InvalidationNone; | 1650 return InvalidationNone; |
1640 | 1651 |
1641 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintIfNeeded()", | 1652 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintIfNeeded()", |
1642 "object", this->debugName().ascii(), | 1653 "object", this->debugName().ascii(), |
1643 "info", jsonObjectForOldAndNewRects(oldBounds, newBounds)); | 1654 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n
ewLocation)); |
1644 | 1655 |
1645 InvalidationReason invalidationReason = getPaintInvalidationReason(paintInva
lidationContainer, oldBounds, oldLocation, newBounds, newLocation); | 1656 InvalidationReason invalidationReason = getPaintInvalidationReason(paintInva
lidationContainer, oldBounds, oldLocation, newBounds, newLocation); |
1646 | 1657 |
1647 if (invalidationReason == InvalidationNone) | 1658 if (invalidationReason == InvalidationNone) |
1648 return invalidationReason; | 1659 return invalidationReason; |
1649 | 1660 |
1650 if (invalidationReason == InvalidationIncremental) { | 1661 if (invalidationReason == InvalidationIncremental) { |
1651 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds, newLocation); | 1662 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds, newLocation); |
1652 return invalidationReason; | 1663 return invalidationReason; |
1653 } | 1664 } |
(...skipping 1801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3455 { | 3466 { |
3456 if (object1) { | 3467 if (object1) { |
3457 const blink::RenderObject* root = object1; | 3468 const blink::RenderObject* root = object1; |
3458 while (root->parent()) | 3469 while (root->parent()) |
3459 root = root->parent(); | 3470 root = root->parent(); |
3460 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3471 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3461 } | 3472 } |
3462 } | 3473 } |
3463 | 3474 |
3464 #endif | 3475 #endif |
OLD | NEW |