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 paintInvalidationContainer = parentRenderFlowThread; | 1457 paintInvalidationContainer = parentRenderFlowThread; |
1458 } | 1458 } |
1459 return paintInvalidationContainer ? paintInvalidationContainer : view(); | 1459 return paintInvalidationContainer ? paintInvalidationContainer : view(); |
1460 } | 1460 } |
1461 | 1461 |
1462 bool RenderObject::isPaintInvalidationContainer() const | 1462 bool RenderObject::isPaintInvalidationContainer() const |
1463 { | 1463 { |
1464 return hasLayer() && toRenderLayerModelObject(this)->layer()->isPaintInvalid
ationContainer(); | 1464 return hasLayer() && toRenderLayerModelObject(this)->layer()->isPaintInvalid
ationContainer(); |
1465 } | 1465 } |
1466 | 1466 |
1467 template<typename T> PassRefPtr<JSONValue> jsonObjectForRect(const T& rect) | 1467 template<typename T> void addJsonObjectForRect(TracedValue& value, const char* n
ame, const T& rect) |
1468 { | 1468 { |
1469 RefPtr<JSONObject> object = JSONObject::create(); | 1469 value.beginDictionary(name) |
1470 object->setNumber("x", rect.x()); | 1470 .setDouble("x", rect.x()) |
1471 object->setNumber("y", rect.y()); | 1471 .setDouble("y", rect.y()) |
1472 object->setNumber("width", rect.width()); | 1472 .setDouble("width", rect.width()) |
1473 object->setNumber("height", rect.height()); | 1473 .setDouble("height", rect.height()) |
1474 return object.release(); | 1474 .endDictionary(); |
1475 } | 1475 } |
1476 | 1476 |
1477 static PassRefPtr<JSONValue> jsonObjectForPaintInvalidationInfo(const IntRect& r
ect, const String& invalidationReason) | 1477 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForPaintInvali
dationInfo(const IntRect& rect, const String& invalidationReason) |
1478 { | 1478 { |
1479 RefPtr<JSONObject> object = JSONObject::create(); | 1479 TracedValue value; |
1480 object->setValue("rect", jsonObjectForRect(rect)); | 1480 addJsonObjectForRect(value, "rect", rect); |
1481 object->setString("invalidation_reason", invalidationReason); | 1481 value.setString("invalidation_reason", invalidationReason); |
1482 return object.release(); | 1482 return value.finish(); |
1483 } | 1483 } |
1484 | 1484 |
1485 LayoutRect RenderObject::computePaintInvalidationRect(const RenderLayerModelObje
ct* paintInvalidationContainer) const | 1485 LayoutRect RenderObject::computePaintInvalidationRect(const RenderLayerModelObje
ct* paintInvalidationContainer) const |
1486 { | 1486 { |
1487 return clippedOverflowRectForPaintInvalidation(paintInvalidationContainer); | 1487 return clippedOverflowRectForPaintInvalidation(paintInvalidationContainer); |
1488 } | 1488 } |
1489 | 1489 |
1490 void RenderObject::invalidatePaintUsingContainer(const RenderLayerModelObject* p
aintInvalidationContainer, const IntRect& r, InvalidationReason invalidationReas
on) const | 1490 void RenderObject::invalidatePaintUsingContainer(const RenderLayerModelObject* p
aintInvalidationContainer, const IntRect& r, InvalidationReason invalidationReas
on) const |
1491 { | 1491 { |
1492 if (r.isEmpty()) | 1492 if (r.isEmpty()) |
1493 return; | 1493 return; |
1494 | 1494 |
1495 // FIXME: This should be an assert, but editing/selection can trigger this c
ase to invalidate | 1495 // FIXME: This should be an assert, but editing/selection can trigger this c
ase to invalidate |
1496 // the selection. crbug.com/368140. | 1496 // the selection. crbug.com/368140. |
1497 if (!isRooted()) | 1497 if (!isRooted()) |
1498 return; | 1498 return; |
1499 | 1499 |
1500 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintUsingContainer()", | 1500 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintUsingContainer()", |
1501 "object", this->debugName().ascii(), | 1501 "object", this->debugName().ascii(), |
1502 "info", TracedValue::fromJSONValue(jsonObjectForPaintInvalidationInfo(r,
invalidationReasonToString(invalidationReason)))); | 1502 "info", jsonObjectForPaintInvalidationInfo(r, invalidationReasonToString
(invalidationReason))); |
1503 | 1503 |
1504 // For querying RenderLayer::compositingState() | 1504 // For querying RenderLayer::compositingState() |
1505 DisableCompositingQueryAsserts disabler; | 1505 DisableCompositingQueryAsserts disabler; |
1506 | 1506 |
1507 if (paintInvalidationContainer->isRenderFlowThread()) { | 1507 if (paintInvalidationContainer->isRenderFlowThread()) { |
1508 toRenderFlowThread(paintInvalidationContainer)->repaintRectangleInRegion
s(r); | 1508 toRenderFlowThread(paintInvalidationContainer)->repaintRectangleInRegion
s(r); |
1509 return; | 1509 return; |
1510 } | 1510 } |
1511 | 1511 |
1512 if (paintInvalidationContainer->hasFilter() && paintInvalidationContainer->l
ayer()->requiresFullLayerImageForFilters()) { | 1512 if (paintInvalidationContainer->hasFilter() && paintInvalidationContainer->l
ayer()->requiresFullLayerImageForFilters()) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1610 return; | 1610 return; |
1611 | 1611 |
1612 clearPaintInvalidationState(); | 1612 clearPaintInvalidationState(); |
1613 | 1613 |
1614 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { | 1614 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { |
1615 if (!child->isOutOfFlowPositioned()) | 1615 if (!child->isOutOfFlowPositioned()) |
1616 child->invalidateTreeAfterLayout(paintInvalidationContainer); | 1616 child->invalidateTreeAfterLayout(paintInvalidationContainer); |
1617 } | 1617 } |
1618 } | 1618 } |
1619 | 1619 |
1620 static PassRefPtr<JSONValue> jsonObjectForOldAndNewRects(const LayoutRect& oldRe
ct, const LayoutRect& newRect) | 1620 static PassRefPtr<TraceEvent::ConvertableToTraceFormat> jsonObjectForOldAndNewRe
cts(const LayoutRect& oldRect, const LayoutRect& newRect) |
1621 { | 1621 { |
1622 RefPtr<JSONObject> object = JSONObject::create(); | 1622 TracedValue value; |
1623 | 1623 addJsonObjectForRect(value, "old", oldRect); |
1624 object->setValue("old", jsonObjectForRect(oldRect)); | 1624 addJsonObjectForRect(value, "new", newRect); |
1625 object->setValue("new", jsonObjectForRect(newRect)); | 1625 return value.finish(); |
1626 return object.release(); | |
1627 } | 1626 } |
1628 | 1627 |
1629 bool RenderObject::invalidatePaintAfterLayoutIfNeeded(const RenderLayerModelObje
ct* paintInvalidationContainer, InvalidationReason invalidationReason, | 1628 bool RenderObject::invalidatePaintAfterLayoutIfNeeded(const RenderLayerModelObje
ct* paintInvalidationContainer, InvalidationReason invalidationReason, |
1630 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t* newBoundsPtr, const LayoutPoint* newLocationPtr) | 1629 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t* newBoundsPtr, const LayoutPoint* newLocationPtr) |
1631 { | 1630 { |
1632 RenderView* v = view(); | 1631 RenderView* v = view(); |
1633 if (v->document().printing()) | 1632 if (v->document().printing()) |
1634 return false; // Don't invalidate paints if we're printing. | 1633 return false; // Don't invalidate paints if we're printing. |
1635 | 1634 |
1636 // This ASSERT fails due to animations. See https://bugs.webkit.org/show_bu
g.cgi?id=37048 | 1635 // This ASSERT fails due to animations. See https://bugs.webkit.org/show_bu
g.cgi?id=37048 |
1637 // ASSERT(!newBoundsPtr || *newBoundsPtr == clippedOverflowRectForPaintInval
idation(paintInvalidationContainer)); | 1636 // ASSERT(!newBoundsPtr || *newBoundsPtr == clippedOverflowRectForPaintInval
idation(paintInvalidationContainer)); |
1638 LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : computePaintInvalidati
onRect(); | 1637 LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : computePaintInvalidati
onRect(); |
1639 LayoutPoint newLocation = newLocationPtr ? (*newLocationPtr) : RenderLayer::
positionFromPaintInvalidationContainer(this, paintInvalidationContainer); | 1638 LayoutPoint newLocation = newLocationPtr ? (*newLocationPtr) : RenderLayer::
positionFromPaintInvalidationContainer(this, paintInvalidationContainer); |
1640 | 1639 |
1641 // FIXME: This should use a ConvertableToTraceFormat when they are available
in Blink. | 1640 // FIXME: This should use a ConvertableToTraceFormat when they are available
in Blink. |
1642 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintAfterLayoutIfNeeded()", | 1641 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintAfterLayoutIfNeeded()", |
1643 "object", this->debugName().ascii(), | 1642 "object", this->debugName().ascii(), |
1644 "info", TracedValue::fromJSONValue(jsonObjectForOldAndNewRects(oldBounds
, newBounds))); | 1643 "info", jsonObjectForOldAndNewRects(oldBounds, newBounds)); |
1645 | 1644 |
1646 // Presumably a background or a border exists if border-fit:lines was specif
ied. | 1645 // Presumably a background or a border exists if border-fit:lines was specif
ied. |
1647 if (invalidationReason == InvalidationIncremental && style()->borderFit() ==
BorderFitLines) | 1646 if (invalidationReason == InvalidationIncremental && style()->borderFit() ==
BorderFitLines) |
1648 invalidationReason = InvalidationBorderFitLines; | 1647 invalidationReason = InvalidationBorderFitLines; |
1649 | 1648 |
1650 if (invalidationReason == InvalidationIncremental && style()->hasBorderRadiu
s()) { | 1649 if (invalidationReason == InvalidationIncremental && style()->hasBorderRadiu
s()) { |
1651 // If a border-radius exists and width/height is smaller than | 1650 // If a border-radius exists and width/height is smaller than |
1652 // radius width/height, we cannot use delta-paint-invalidation. | 1651 // radius width/height, we cannot use delta-paint-invalidation. |
1653 RoundedRect oldRoundedRect = style()->getRoundedBorderFor(oldBounds); | 1652 RoundedRect oldRoundedRect = style()->getRoundedBorderFor(oldBounds); |
1654 RoundedRect newRoundedRect = style()->getRoundedBorderFor(newBounds); | 1653 RoundedRect newRoundedRect = style()->getRoundedBorderFor(newBounds); |
(...skipping 1861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3516 { | 3515 { |
3517 if (object1) { | 3516 if (object1) { |
3518 const WebCore::RenderObject* root = object1; | 3517 const WebCore::RenderObject* root = object1; |
3519 while (root->parent()) | 3518 while (root->parent()) |
3520 root = root->parent(); | 3519 root = root->parent(); |
3521 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3520 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3522 } | 3521 } |
3523 } | 3522 } |
3524 | 3523 |
3525 #endif | 3524 #endif |
OLD | NEW |