| 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 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1434 paintInvalidationContainer = parentRenderFlowThread; | 1434 paintInvalidationContainer = parentRenderFlowThread; |
| 1435 } | 1435 } |
| 1436 return paintInvalidationContainer ? paintInvalidationContainer : view(); | 1436 return paintInvalidationContainer ? paintInvalidationContainer : view(); |
| 1437 } | 1437 } |
| 1438 | 1438 |
| 1439 bool RenderObject::isPaintInvalidationContainer() const | 1439 bool RenderObject::isPaintInvalidationContainer() const |
| 1440 { | 1440 { |
| 1441 return hasLayer() && toRenderLayerModelObject(this)->layer()->isPaintInvalid
ationContainer(); | 1441 return hasLayer() && toRenderLayerModelObject(this)->layer()->isPaintInvalid
ationContainer(); |
| 1442 } | 1442 } |
| 1443 | 1443 |
| 1444 template<typename T> PassRefPtr<JSONValue> jsonObjectForRect(const T& rect) | 1444 template<typename T> void addJsonObjectForRect(TracedValue& value, const char* n
ame, const T& rect) |
| 1445 { | 1445 { |
| 1446 RefPtr<JSONObject> object = JSONObject::create(); | 1446 value.beginDictionary(name) |
| 1447 object->setNumber("x", rect.x()); | 1447 .setDouble("x", rect.x()) |
| 1448 object->setNumber("y", rect.y()); | 1448 .setDouble("y", rect.y()) |
| 1449 object->setNumber("width", rect.width()); | 1449 .setDouble("width", rect.width()) |
| 1450 object->setNumber("height", rect.height()); | 1450 .setDouble("height", rect.height()) |
| 1451 return object.release(); | 1451 .endDictionary(); |
| 1452 } | 1452 } |
| 1453 | 1453 |
| 1454 static PassRefPtr<JSONValue> jsonObjectForPaintInvalidationInfo(const IntRect& r
ect, const String& invalidationReason) | 1454 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForPaintInvali
dationInfo(const IntRect& rect, const String& invalidationReason) |
| 1455 { | 1455 { |
| 1456 RefPtr<JSONObject> object = JSONObject::create(); | 1456 TracedValue value; |
| 1457 object->setValue("rect", jsonObjectForRect(rect)); | 1457 addJsonObjectForRect(value, "rect", rect); |
| 1458 object->setString("invalidation_reason", invalidationReason); | 1458 value.setString("invalidation_reason", invalidationReason); |
| 1459 return object.release(); | 1459 return value.finish(); |
| 1460 } | 1460 } |
| 1461 | 1461 |
| 1462 LayoutRect RenderObject::computePaintInvalidationRect(const RenderLayerModelObje
ct* paintInvalidationContainer) const | 1462 LayoutRect RenderObject::computePaintInvalidationRect(const RenderLayerModelObje
ct* paintInvalidationContainer) const |
| 1463 { | 1463 { |
| 1464 return clippedOverflowRectForPaintInvalidation(paintInvalidationContainer); | 1464 return clippedOverflowRectForPaintInvalidation(paintInvalidationContainer); |
| 1465 } | 1465 } |
| 1466 | 1466 |
| 1467 void RenderObject::invalidatePaintUsingContainer(const RenderLayerModelObject* p
aintInvalidationContainer, const IntRect& r, InvalidationReason invalidationReas
on) const | 1467 void RenderObject::invalidatePaintUsingContainer(const RenderLayerModelObject* p
aintInvalidationContainer, const IntRect& r, InvalidationReason invalidationReas
on) const |
| 1468 { | 1468 { |
| 1469 if (r.isEmpty()) | 1469 if (r.isEmpty()) |
| 1470 return; | 1470 return; |
| 1471 | 1471 |
| 1472 // FIXME: This should be an assert, but editing/selection can trigger this c
ase to invalidate | 1472 // FIXME: This should be an assert, but editing/selection can trigger this c
ase to invalidate |
| 1473 // the selection. crbug.com/368140. | 1473 // the selection. crbug.com/368140. |
| 1474 if (!isRooted()) | 1474 if (!isRooted()) |
| 1475 return; | 1475 return; |
| 1476 | 1476 |
| 1477 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintUsingContainer()", | 1477 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintUsingContainer()", |
| 1478 "object", this->debugName().ascii(), | 1478 "object", this->debugName().ascii(), |
| 1479 "info", TracedValue::fromJSONValue(jsonObjectForPaintInvalidationInfo(r,
invalidationReasonToString(invalidationReason)))); | 1479 "info", jsonObjectForPaintInvalidationInfo(r, invalidationReasonToString
(invalidationReason))); |
| 1480 | 1480 |
| 1481 // For querying RenderLayer::compositingState() | 1481 // For querying RenderLayer::compositingState() |
| 1482 DisableCompositingQueryAsserts disabler; | 1482 DisableCompositingQueryAsserts disabler; |
| 1483 | 1483 |
| 1484 if (paintInvalidationContainer->isRenderFlowThread()) { | 1484 if (paintInvalidationContainer->isRenderFlowThread()) { |
| 1485 toRenderFlowThread(paintInvalidationContainer)->repaintRectangleInRegion
s(r); | 1485 toRenderFlowThread(paintInvalidationContainer)->repaintRectangleInRegion
s(r); |
| 1486 return; | 1486 return; |
| 1487 } | 1487 } |
| 1488 | 1488 |
| 1489 if (paintInvalidationContainer->hasFilter() && paintInvalidationContainer->l
ayer()->requiresFullLayerImageForFilters()) { | 1489 if (paintInvalidationContainer->hasFilter() && paintInvalidationContainer->l
ayer()->requiresFullLayerImageForFilters()) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 return; | 1589 return; |
| 1590 | 1590 |
| 1591 clearPaintInvalidationState(); | 1591 clearPaintInvalidationState(); |
| 1592 | 1592 |
| 1593 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { | 1593 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { |
| 1594 if (!child->isOutOfFlowPositioned()) | 1594 if (!child->isOutOfFlowPositioned()) |
| 1595 child->invalidateTreeAfterLayout(paintInvalidationContainer); | 1595 child->invalidateTreeAfterLayout(paintInvalidationContainer); |
| 1596 } | 1596 } |
| 1597 } | 1597 } |
| 1598 | 1598 |
| 1599 static PassRefPtr<JSONValue> jsonObjectForOldAndNewRects(const LayoutRect& oldRe
ct, const LayoutRect& newRect) | 1599 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe
cts(const LayoutRect& oldRect, const LayoutRect& newRect) |
| 1600 { | 1600 { |
| 1601 RefPtr<JSONObject> object = JSONObject::create(); | 1601 TracedValue value; |
| 1602 | 1602 addJsonObjectForRect(value, "old", oldRect); |
| 1603 object->setValue("old", jsonObjectForRect(oldRect)); | 1603 addJsonObjectForRect(value, "new", newRect); |
| 1604 object->setValue("new", jsonObjectForRect(newRect)); | 1604 return value.finish(); |
| 1605 return object.release(); | |
| 1606 } | 1605 } |
| 1607 | 1606 |
| 1608 bool RenderObject::invalidatePaintIfNeeded(const RenderLayerModelObject* paintIn
validationContainer, const LayoutRect& oldBounds, const LayoutPoint& oldLocation
) | 1607 bool RenderObject::invalidatePaintIfNeeded(const RenderLayerModelObject* paintIn
validationContainer, const LayoutRect& oldBounds, const LayoutPoint& oldLocation
) |
| 1609 { | 1608 { |
| 1610 RenderView* v = view(); | 1609 RenderView* v = view(); |
| 1611 if (v->document().printing()) | 1610 if (v->document().printing()) |
| 1612 return false; // Don't invalidate paints if we're printing. | 1611 return false; // Don't invalidate paints if we're printing. |
| 1613 | 1612 |
| 1614 const LayoutRect& newBounds = previousPaintInvalidationRect(); | 1613 const LayoutRect& newBounds = previousPaintInvalidationRect(); |
| 1615 const LayoutPoint& newLocation = previousPositionFromPaintInvalidationContai
ner(); | 1614 const LayoutPoint& newLocation = previousPositionFromPaintInvalidationContai
ner(); |
| 1616 | 1615 |
| 1617 ASSERT(newBounds == boundsRectForPaintInvalidation(paintInvalidationContaine
r)); | 1616 ASSERT(newBounds == boundsRectForPaintInvalidation(paintInvalidationContaine
r)); |
| 1618 | 1617 |
| 1619 // FIXME: This should use a ConvertableToTraceFormat when they are available
in Blink. | 1618 // FIXME: This should use a ConvertableToTraceFormat when they are available
in Blink. |
| 1620 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintIfNeeded()", | 1619 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintIfNeeded()", |
| 1621 "object", this->debugName().ascii(), | 1620 "object", this->debugName().ascii(), |
| 1622 "info", TracedValue::fromJSONValue(jsonObjectForOldAndNewRects(oldBounds
, newBounds))); | 1621 "info", jsonObjectForOldAndNewRects(oldBounds, newBounds)); |
| 1623 | 1622 |
| 1624 InvalidationReason invalidationReason = getPaintInvalidationReason(paintInva
lidationContainer, oldBounds, oldLocation, newBounds, newLocation); | 1623 InvalidationReason invalidationReason = getPaintInvalidationReason(paintInva
lidationContainer, oldBounds, oldLocation, newBounds, newLocation); |
| 1625 | 1624 |
| 1626 if (invalidationReason == InvalidationNone) | 1625 if (invalidationReason == InvalidationNone) |
| 1627 return false; | 1626 return false; |
| 1628 | 1627 |
| 1629 if (invalidationReason == InvalidationIncremental) { | 1628 if (invalidationReason == InvalidationIncremental) { |
| 1630 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds); | 1629 incrementallyInvalidatePaint(paintInvalidationContainer, oldBounds, newB
ounds); |
| 1631 return false; | 1630 return false; |
| 1632 } | 1631 } |
| (...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3432 { | 3431 { |
| 3433 if (object1) { | 3432 if (object1) { |
| 3434 const WebCore::RenderObject* root = object1; | 3433 const WebCore::RenderObject* root = object1; |
| 3435 while (root->parent()) | 3434 while (root->parent()) |
| 3436 root = root->parent(); | 3435 root = root->parent(); |
| 3437 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3436 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 3438 } | 3437 } |
| 3439 } | 3438 } |
| 3440 | 3439 |
| 3441 #endif | 3440 #endif |
| OLD | NEW |