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 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 object->setValue("rect", jsonObjectForRect(rect)); | 1490 object->setValue("rect", jsonObjectForRect(rect)); |
1491 object->setString("invalidation_reason", invalidationReason); | 1491 object->setString("invalidation_reason", invalidationReason); |
1492 return object.release(); | 1492 return object.release(); |
1493 } | 1493 } |
1494 | 1494 |
1495 LayoutRect RenderObject::computeRepaintRect(const RenderLayerModelObject* repain
tContainer) const | 1495 LayoutRect RenderObject::computeRepaintRect(const RenderLayerModelObject* repain
tContainer) const |
1496 { | 1496 { |
1497 return clippedOverflowRectForRepaint(repaintContainer); | 1497 return clippedOverflowRectForRepaint(repaintContainer); |
1498 } | 1498 } |
1499 | 1499 |
1500 void RenderObject::repaintUsingContainer(const RenderLayerModelObject* repaintCo
ntainer, const IntRect& r, InvalidationReason invalidationReason) const | 1500 void RenderObject::invalidatePaintUsingContainer(const RenderLayerModelObject* p
aintInvalidationContainer, const IntRect& r, InvalidationReason invalidationReas
on) const |
1501 { | 1501 { |
1502 if (r.isEmpty()) | 1502 if (r.isEmpty()) |
1503 return; | 1503 return; |
1504 | 1504 |
1505 // FIXME: This should be an assert, but editing/selection can trigger this c
ase to invalidate | 1505 // FIXME: This should be an assert, but editing/selection can trigger this c
ase to invalidate |
1506 // the selection. crbug.com/368140. | 1506 // the selection. crbug.com/368140. |
1507 if (!isRooted()) | 1507 if (!isRooted()) |
1508 return; | 1508 return; |
1509 | 1509 |
1510 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:repaintUsingContainer()", | 1510 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintUsingContainer()", |
1511 "object", this->debugName().ascii(), | 1511 "object", this->debugName().ascii(), |
1512 "info", TracedValue::fromJSONValue(jsonObjectForRepaintInfo(r, invalidat
ionReasonToString(invalidationReason)))); | 1512 "info", TracedValue::fromJSONValue(jsonObjectForRepaintInfo(r, invalidat
ionReasonToString(invalidationReason)))); |
1513 | 1513 |
1514 // FIXME: Don't read compositing state here since we do this in the middle o
f recalc/layout. | 1514 // FIXME: Don't read compositing state here since we do this in the middle o
f recalc/layout. |
1515 DisableCompositingQueryAsserts disabler; | 1515 DisableCompositingQueryAsserts disabler; |
1516 if (repaintContainer->compositingState() == PaintsIntoGroupedBacking) { | 1516 if (paintInvalidationContainer->compositingState() == PaintsIntoGroupedBacki
ng) { |
1517 ASSERT(repaintContainer->groupedMapping()); | 1517 ASSERT(paintInvalidationContainer->groupedMapping()); |
1518 ASSERT(repaintContainer->layer()); | 1518 ASSERT(paintInvalidationContainer->layer()); |
1519 | 1519 |
1520 // Not clean, but if squashing layer does not yet exist here (e.g. repai
nt invalidation coming from within recomputing compositing requirements) | 1520 // Not clean, but if squashing layer does not yet exist here (e.g. paint
invalidation coming from within recomputing compositing requirements) |
1521 // then it's ok to just exit here, since the squashing layer will get re
painted when it is newly created. | 1521 // then it's ok to just exit here, since the squashing layer will get in
validate when it is newly created. |
1522 if (!repaintContainer->groupedMapping()->squashingLayer()) | 1522 if (!paintInvalidationContainer->groupedMapping()->squashingLayer()) |
1523 return; | 1523 return; |
1524 } | 1524 } |
1525 | 1525 |
1526 if (repaintContainer->isRenderFlowThread()) { | 1526 if (paintInvalidationContainer->isRenderFlowThread()) { |
1527 toRenderFlowThread(repaintContainer)->repaintRectangleInRegions(r); | 1527 toRenderFlowThread(paintInvalidationContainer)->repaintRectangleInRegion
s(r); |
1528 return; | 1528 return; |
1529 } | 1529 } |
1530 | 1530 |
1531 if (repaintContainer->hasFilter() && repaintContainer->layer()->requiresFull
LayerImageForFilters()) { | 1531 if (paintInvalidationContainer->hasFilter() && paintInvalidationContainer->l
ayer()->requiresFullLayerImageForFilters()) { |
1532 repaintContainer->layer()->repainter().setFilterBackendNeedsRepaintingIn
Rect(r); | 1532 paintInvalidationContainer->layer()->repainter().setFilterBackendNeedsRe
paintingInRect(r); |
1533 return; | 1533 return; |
1534 } | 1534 } |
1535 | 1535 |
1536 RenderView* v = view(); | 1536 RenderView* v = view(); |
1537 if (repaintContainer->isRenderView()) { | 1537 if (paintInvalidationContainer->isRenderView()) { |
1538 ASSERT(repaintContainer == v); | 1538 ASSERT(paintInvalidationContainer == v); |
1539 v->repaintViewRectangle(r); | 1539 v->repaintViewRectangle(r); |
1540 return; | 1540 return; |
1541 } | 1541 } |
1542 | 1542 |
1543 if (v->usesCompositing()) { | 1543 if (v->usesCompositing()) { |
1544 ASSERT(repaintContainer->hasLayer() && (repaintContainer->layer()->compo
sitingState() == PaintsIntoOwnBacking || repaintContainer->layer()->compositingS
tate() == PaintsIntoGroupedBacking)); | 1544 ASSERT(paintInvalidationContainer->hasLayer() && (paintInvalidationConta
iner->layer()->compositingState() == PaintsIntoOwnBacking || paintInvalidationCo
ntainer->layer()->compositingState() == PaintsIntoGroupedBacking)); |
1545 repaintContainer->layer()->repainter().setBackingNeedsRepaintInRect(r); | 1545 paintInvalidationContainer->layer()->repainter().setBackingNeedsRepaintI
nRect(r); |
1546 } | 1546 } |
1547 } | 1547 } |
1548 | 1548 |
1549 void RenderObject::repaint() const | 1549 void RenderObject::paintInvalidationForWholeRenderer() const |
1550 { | 1550 { |
1551 if (!isRooted()) | 1551 if (!isRooted()) |
1552 return; | 1552 return; |
1553 | 1553 |
1554 if (view()->document().printing()) | 1554 if (view()->document().printing()) |
1555 return; // Don't repaint if we're printing. | 1555 return; // Don't invalidate paints if we're printing. |
1556 | 1556 |
1557 // FIXME: really, we're in the repaint phase here, and the following queries
are legal. | 1557 // FIXME: really, we're in the paint invalidation phase here, and the follow
ing queries are legal. |
1558 // Until those states are fully fledged, I'll just disable the ASSERTS. | 1558 // Until those states are fully fledged, I'll just disable the ASSERTS. |
1559 DisableCompositingQueryAsserts disabler; | 1559 DisableCompositingQueryAsserts disabler; |
1560 const RenderLayerModelObject* repaintContainer = containerForRepaint(); | 1560 const RenderLayerModelObject* paintInvalidationContainer = containerForRepai
nt(); |
1561 LayoutRect repaintRect = boundsRectForRepaint(repaintContainer); | 1561 LayoutRect paintInvalidationRect = boundsRectForRepaint(paintInvalidationCon
tainer); |
1562 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(repaintRect), In
validationRepaint); | 1562 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRec
t(paintInvalidationRect), InvalidationRepaint); |
1563 } | 1563 } |
1564 | 1564 |
1565 LayoutRect RenderObject::boundsRectForRepaint(const RenderLayerModelObject* repa
intContainer) const | 1565 LayoutRect RenderObject::boundsRectForRepaint(const RenderLayerModelObject* repa
intContainer) const |
1566 { | 1566 { |
1567 if (!repaintContainer) | 1567 if (!repaintContainer) |
1568 return computeRepaintRect(repaintContainer); | 1568 return computeRepaintRect(repaintContainer); |
1569 return RenderLayer::computeRepaintRect(this, repaintContainer->layer()); | 1569 return RenderLayer::computeRepaintRect(this, repaintContainer->layer()); |
1570 } | 1570 } |
1571 | 1571 |
1572 void RenderObject::repaintRectangle(const LayoutRect& r) const | 1572 void RenderObject::invalidatePaintRectangle(const LayoutRect& r) const |
1573 { | 1573 { |
1574 if (!isRooted()) | 1574 if (!isRooted()) |
1575 return; | 1575 return; |
1576 | 1576 |
1577 if (view()->document().printing()) | 1577 if (view()->document().printing()) |
1578 return; // Don't repaint if we're printing. | 1578 return; // Don't invalidate paints if we're printing. |
1579 | 1579 |
1580 LayoutRect dirtyRect(r); | 1580 LayoutRect dirtyRect(r); |
1581 | 1581 |
1582 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { | 1582 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { |
1583 // FIXME: layoutDelta needs to be applied in parts before/after transfor
ms and | 1583 // FIXME: layoutDelta needs to be applied in parts before/after transfor
ms and |
1584 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 | 1584 // paint invalidation containers. https://bugs.webkit.org/show_bug.cgi?i
d=23308 |
1585 dirtyRect.move(view()->layoutDelta()); | 1585 dirtyRect.move(view()->layoutDelta()); |
1586 } | 1586 } |
1587 | 1587 |
1588 const RenderLayerModelObject* repaintContainer = containerForRepaint(); | 1588 const RenderLayerModelObject* paintInvalidationContainer = containerForRepai
nt(); |
1589 RenderLayer::mapRectToRepaintBacking(this, repaintContainer, dirtyRect); | 1589 RenderLayer::mapRectToRepaintBacking(this, paintInvalidationContainer, dirty
Rect); |
1590 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(dirtyRect), Inva
lidationRepaintRectangle); | 1590 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRec
t(dirtyRect), InvalidationRepaintRectangle); |
1591 } | 1591 } |
1592 | 1592 |
1593 IntRect RenderObject::pixelSnappedAbsoluteClippedOverflowRect() const | 1593 IntRect RenderObject::pixelSnappedAbsoluteClippedOverflowRect() const |
1594 { | 1594 { |
1595 return pixelSnappedIntRect(absoluteClippedOverflowRect()); | 1595 return pixelSnappedIntRect(absoluteClippedOverflowRect()); |
1596 } | 1596 } |
1597 | 1597 |
1598 const char* RenderObject::invalidationReasonToString(InvalidationReason reason)
const | 1598 const char* RenderObject::invalidationReasonToString(InvalidationReason reason)
const |
1599 { | 1599 { |
1600 switch (reason) { | 1600 switch (reason) { |
(...skipping 11 matching lines...) Expand all Loading... |
1612 return "bounds change"; | 1612 return "bounds change"; |
1613 case InvalidationLocationChange: | 1613 case InvalidationLocationChange: |
1614 return "location change"; | 1614 return "location change"; |
1615 case InvalidationScroll: | 1615 case InvalidationScroll: |
1616 return "scroll"; | 1616 return "scroll"; |
1617 case InvalidationSelection: | 1617 case InvalidationSelection: |
1618 return "selection"; | 1618 return "selection"; |
1619 case InvalidationLayer: | 1619 case InvalidationLayer: |
1620 return "layer"; | 1620 return "layer"; |
1621 case InvalidationRepaint: | 1621 case InvalidationRepaint: |
1622 return "repaint"; | 1622 return "invalidate paint"; |
1623 case InvalidationRepaintRectangle: | 1623 case InvalidationRepaintRectangle: |
1624 return "repaint rectangle"; | 1624 return "invalidate paint rectangle"; |
1625 } | 1625 } |
1626 ASSERT_NOT_REACHED(); | 1626 ASSERT_NOT_REACHED(); |
1627 return ""; | 1627 return ""; |
1628 } | 1628 } |
1629 | 1629 |
1630 void RenderObject::invalidateTreeAfterLayout(const RenderLayerModelObject& paint
InvalidationContainer) | 1630 void RenderObject::invalidateTreeAfterLayout(const RenderLayerModelObject& paint
InvalidationContainer) |
1631 { | 1631 { |
1632 // If we didn't need paint invalidation then our children don't need as well
. | 1632 // If we didn't need paint invalidation then our children don't need as well
. |
1633 // Skip walking down the tree as everything should be fine below us. | 1633 // Skip walking down the tree as everything should be fine below us. |
1634 if (!shouldCheckForPaintInvalidationAfterLayout()) | 1634 if (!shouldCheckForPaintInvalidationAfterLayout()) |
1635 return; | 1635 return; |
1636 | 1636 |
1637 clearPaintInvalidationState(); | 1637 clearPaintInvalidationState(); |
1638 | 1638 |
1639 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { | 1639 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { |
1640 if (!child->isOutOfFlowPositioned()) | 1640 if (!child->isOutOfFlowPositioned()) |
1641 child->invalidateTreeAfterLayout(paintInvalidationContainer); | 1641 child->invalidateTreeAfterLayout(paintInvalidationContainer); |
1642 } | 1642 } |
1643 } | 1643 } |
1644 | 1644 |
1645 static PassRefPtr<JSONValue> jsonObjectForOldAndNewRects(const LayoutRect& oldRe
ct, const LayoutRect& newRect) | 1645 static PassRefPtr<JSONValue> jsonObjectForOldAndNewRects(const LayoutRect& oldRe
ct, const LayoutRect& newRect) |
1646 { | 1646 { |
1647 RefPtr<JSONObject> object = JSONObject::create(); | 1647 RefPtr<JSONObject> object = JSONObject::create(); |
1648 | 1648 |
1649 object->setValue("old", jsonObjectForRect(oldRect)); | 1649 object->setValue("old", jsonObjectForRect(oldRect)); |
1650 object->setValue("new", jsonObjectForRect(newRect)); | 1650 object->setValue("new", jsonObjectForRect(newRect)); |
1651 return object.release(); | 1651 return object.release(); |
1652 } | 1652 } |
1653 | 1653 |
1654 bool RenderObject::repaintAfterLayoutIfNeeded(const RenderLayerModelObject* repa
intContainer, bool wasSelfLayout, | 1654 bool RenderObject::invalidatePaintAfterLayoutIfNeeded(const RenderLayerModelObje
ct* paintInvalidationContainer, bool wasSelfLayout, |
1655 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t* newBoundsPtr, const LayoutPoint* newLocationPtr) | 1655 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t* newBoundsPtr, const LayoutPoint* newLocationPtr) |
1656 { | 1656 { |
1657 RenderView* v = view(); | 1657 RenderView* v = view(); |
1658 if (v->document().printing()) | 1658 if (v->document().printing()) |
1659 return false; // Don't repaint if we're printing. | 1659 return false; // Don't invalidate paints if we're printing. |
1660 | 1660 |
1661 // This ASSERT fails due to animations. See https://bugs.webkit.org/show_bu
g.cgi?id=37048 | 1661 // This ASSERT fails due to animations. See https://bugs.webkit.org/show_bu
g.cgi?id=37048 |
1662 // ASSERT(!newBoundsPtr || *newBoundsPtr == clippedOverflowRectForRepaint(re
paintContainer)); | 1662 // ASSERT(!newBoundsPtr || *newBoundsPtr == clippedOverflowRectForRepaint(pa
intInvalidationContainer)); |
1663 LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : computeRepaintRect(); | 1663 LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : computeRepaintRect(); |
1664 LayoutPoint newLocation = newLocationPtr ? (*newLocationPtr) : positionFromR
epaintContainer(repaintContainer); | 1664 LayoutPoint newLocation = newLocationPtr ? (*newLocationPtr) : positionFromR
epaintContainer(paintInvalidationContainer); |
1665 | 1665 |
1666 // FIXME: This should use a ConvertableToTraceFormat when they are available
in Blink. | 1666 // FIXME: This should use a ConvertableToTraceFormat when they are available
in Blink. |
1667 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:repaintAfterLayoutIfNeeded()", | 1667 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "RenderObject:
:invalidatePaintAfterLayoutIfNeeded()", |
1668 "object", this->debugName().ascii(), | 1668 "object", this->debugName().ascii(), |
1669 "info", TracedValue::fromJSONValue(jsonObjectForOldAndNewRects(oldBounds
, newBounds))); | 1669 "info", TracedValue::fromJSONValue(jsonObjectForOldAndNewRects(oldBounds
, newBounds))); |
1670 | 1670 |
1671 InvalidationReason invalidationReason = wasSelfLayout ? InvalidationSelfLayo
ut : InvalidationIncremental; | 1671 InvalidationReason invalidationReason = wasSelfLayout ? InvalidationSelfLayo
ut : InvalidationIncremental; |
1672 | 1672 |
1673 // Presumably a background or a border exists if border-fit:lines was specif
ied. | 1673 // Presumably a background or a border exists if border-fit:lines was specif
ied. |
1674 if (invalidationReason == InvalidationIncremental && style()->borderFit() ==
BorderFitLines) | 1674 if (invalidationReason == InvalidationIncremental && style()->borderFit() ==
BorderFitLines) |
1675 invalidationReason = InvalidationBorderFitLines; | 1675 invalidationReason = InvalidationBorderFitLines; |
1676 | 1676 |
1677 if (invalidationReason == InvalidationIncremental && style()->hasBorderRadiu
s()) { | 1677 if (invalidationReason == InvalidationIncremental && style()->hasBorderRadiu
s()) { |
1678 // If a border-radius exists and width/height is smaller than | 1678 // If a border-radius exists and width/height is smaller than |
1679 // radius width/height, we cannot use delta-repaint. | 1679 // radius width/height, we cannot use delta-paint-invalidation. |
1680 RoundedRect oldRoundedRect = style()->getRoundedBorderFor(oldBounds); | 1680 RoundedRect oldRoundedRect = style()->getRoundedBorderFor(oldBounds); |
1681 RoundedRect newRoundedRect = style()->getRoundedBorderFor(newBounds); | 1681 RoundedRect newRoundedRect = style()->getRoundedBorderFor(newBounds); |
1682 if (oldRoundedRect.radii() != newRoundedRect.radii()) | 1682 if (oldRoundedRect.radii() != newRoundedRect.radii()) |
1683 invalidationReason = InvalidationBorderRadius; | 1683 invalidationReason = InvalidationBorderRadius; |
1684 } | 1684 } |
1685 | 1685 |
1686 if (invalidationReason == InvalidationIncremental && compositingState() != P
aintsIntoOwnBacking && newLocation != oldLocation) | 1686 if (invalidationReason == InvalidationIncremental && compositingState() != P
aintsIntoOwnBacking && newLocation != oldLocation) |
1687 invalidationReason = InvalidationLocationChange; | 1687 invalidationReason = InvalidationLocationChange; |
1688 | 1688 |
1689 // If the bounds are the same then we know that none of the statements below | 1689 // If the bounds are the same then we know that none of the statements below |
(...skipping 14 matching lines...) Expand all Loading... |
1704 if (invalidationReason == InvalidationIncremental && newBounds.location() !=
oldBounds.location()) | 1704 if (invalidationReason == InvalidationIncremental && newBounds.location() !=
oldBounds.location()) |
1705 invalidationReason = InvalidationBoundsChange; | 1705 invalidationReason = InvalidationBoundsChange; |
1706 | 1706 |
1707 // If the size is zero on one of our bounds then we know we're going to have | 1707 // If the size is zero on one of our bounds then we know we're going to have |
1708 // to do a full invalidation of either old bounds or new bounds. If we fall | 1708 // to do a full invalidation of either old bounds or new bounds. If we fall |
1709 // into the incremental invalidation we'll issue two invalidations instead | 1709 // into the incremental invalidation we'll issue two invalidations instead |
1710 // of one. | 1710 // of one. |
1711 if (invalidationReason == InvalidationIncremental && (oldBounds.size().isZer
o() || newBounds.size().isZero())) | 1711 if (invalidationReason == InvalidationIncremental && (oldBounds.size().isZer
o() || newBounds.size().isZero())) |
1712 invalidationReason = InvalidationBoundsChange; | 1712 invalidationReason = InvalidationBoundsChange; |
1713 | 1713 |
1714 ASSERT(repaintContainer); | 1714 ASSERT(paintInvalidationContainer); |
1715 | 1715 |
1716 if (invalidationReason != InvalidationIncremental) { | 1716 if (invalidationReason != InvalidationIncremental) { |
1717 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds),
invalidationReason); | 1717 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(oldBounds), invalidationReason); |
1718 if (newBounds != oldBounds) | 1718 if (newBounds != oldBounds) |
1719 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBound
s), invalidationReason); | 1719 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnapp
edIntRect(newBounds), invalidationReason); |
1720 return true; | 1720 return true; |
1721 } | 1721 } |
1722 | 1722 |
1723 LayoutUnit deltaLeft = newBounds.x() - oldBounds.x(); | 1723 LayoutUnit deltaLeft = newBounds.x() - oldBounds.x(); |
1724 if (deltaLeft > 0) | 1724 if (deltaLeft > 0) |
1725 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds.x(
), oldBounds.y(), deltaLeft, oldBounds.height()), invalidationReason); | 1725 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(oldBounds.x(), oldBounds.y(), deltaLeft, oldBounds.height()), invalidation
Reason); |
1726 else if (deltaLeft < 0) | 1726 else if (deltaLeft < 0) |
1727 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBounds.x(
), newBounds.y(), -deltaLeft, newBounds.height()), invalidationReason); | 1727 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height()), invalidatio
nReason); |
1728 | 1728 |
1729 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); | 1729 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); |
1730 if (deltaRight > 0) | 1730 if (deltaRight > 0) |
1731 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds.ma
xX(), newBounds.y(), deltaRight, newBounds.height()), invalidationReason); | 1731 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()), invalida
tionReason); |
1732 else if (deltaRight < 0) | 1732 else if (deltaRight < 0) |
1733 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBounds.ma
xX(), oldBounds.y(), -deltaRight, oldBounds.height()), invalidationReason); | 1733 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()), invalid
ationReason); |
1734 | 1734 |
1735 LayoutUnit deltaTop = newBounds.y() - oldBounds.y(); | 1735 LayoutUnit deltaTop = newBounds.y() - oldBounds.y(); |
1736 if (deltaTop > 0) | 1736 if (deltaTop > 0) |
1737 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds.x(
), oldBounds.y(), oldBounds.width(), deltaTop), invalidationReason); | 1737 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop), invalidationRe
ason); |
1738 else if (deltaTop < 0) | 1738 else if (deltaTop < 0) |
1739 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBounds.x(
), newBounds.y(), newBounds.width(), -deltaTop), invalidationReason); | 1739 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop), invalidationR
eason); |
1740 | 1740 |
1741 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); | 1741 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); |
1742 if (deltaBottom > 0) | 1742 if (deltaBottom > 0) |
1743 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBounds.x(
), oldBounds.maxY(), newBounds.width(), deltaBottom), invalidationReason); | 1743 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom), invalida
tionReason); |
1744 else if (deltaBottom < 0) | 1744 else if (deltaBottom < 0) |
1745 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds.x(
), newBounds.maxY(), oldBounds.width(), -deltaBottom), invalidationReason); | 1745 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIn
tRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom), invalid
ationReason); |
1746 | 1746 |
1747 // FIXME: This is a limitation of our visual overflow being a single rectang
le. | 1747 // FIXME: This is a limitation of our visual overflow being a single rectang
le. |
1748 if (!style()->boxShadow() && !style()->hasBorderImageOutsets() && !style()->
hasOutline()) | 1748 if (!style()->boxShadow() && !style()->hasBorderImageOutsets() && !style()->
hasOutline()) |
1749 return false; | 1749 return false; |
1750 | 1750 |
1751 // We didn't move, but we did change size. Invalidate the delta, which will
consist of possibly | 1751 // We didn't move, but we did change size. Invalidate the delta, which will
consist of possibly |
1752 // two rectangles (but typically only one). | 1752 // two rectangles (but typically only one). |
1753 RenderStyle* outlineStyle = outlineStyleForRepaint(); | 1753 RenderStyle* outlineStyle = outlineStyleForRepaint(); |
1754 LayoutUnit outlineWidth = outlineStyle->outlineSize(); | 1754 LayoutUnit outlineWidth = outlineStyle->outlineSize(); |
1755 LayoutBoxExtent insetShadowExtent = style()->getBoxShadowInsetExtent(); | 1755 LayoutBoxExtent insetShadowExtent = style()->getBoxShadowInsetExtent(); |
1756 LayoutUnit width = absoluteValue(newBounds.width() - oldBounds.width()); | 1756 LayoutUnit width = absoluteValue(newBounds.width() - oldBounds.width()); |
1757 if (width) { | 1757 if (width) { |
1758 LayoutUnit shadowLeft; | 1758 LayoutUnit shadowLeft; |
1759 LayoutUnit shadowRight; | 1759 LayoutUnit shadowRight; |
1760 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight); | 1760 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight); |
1761 int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0; | 1761 int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0; |
1762 LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit(
); | 1762 LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit(
); |
1763 LayoutUnit minInsetRightShadowExtent = min<LayoutUnit>(-insetShadowExten
t.right(), min<LayoutUnit>(newBounds.width(), oldBounds.width())); | 1763 LayoutUnit minInsetRightShadowExtent = min<LayoutUnit>(-insetShadowExten
t.right(), min<LayoutUnit>(newBounds.width(), oldBounds.width())); |
1764 LayoutUnit borderWidth = max<LayoutUnit>(borderRight, max<LayoutUnit>(va
lueForLength(style()->borderTopRightRadius().width(), boxWidth), valueForLength(
style()->borderBottomRightRadius().width(), boxWidth))); | 1764 LayoutUnit borderWidth = max<LayoutUnit>(borderRight, max<LayoutUnit>(va
lueForLength(style()->borderTopRightRadius().width(), boxWidth), valueForLength(
style()->borderBottomRightRadius().width(), boxWidth))); |
1765 LayoutUnit decorationsLeftWidth = max<LayoutUnit>(-outlineStyle->outline
Offset(), borderWidth + minInsetRightShadowExtent) + max<LayoutUnit>(outlineWidt
h, -shadowLeft); | 1765 LayoutUnit decorationsLeftWidth = max<LayoutUnit>(-outlineStyle->outline
Offset(), borderWidth + minInsetRightShadowExtent) + max<LayoutUnit>(outlineWidt
h, -shadowLeft); |
1766 LayoutUnit decorationsRightWidth = max<LayoutUnit>(-outlineStyle->outlin
eOffset(), borderWidth + minInsetRightShadowExtent) + max<LayoutUnit>(outlineWid
th, shadowRight); | 1766 LayoutUnit decorationsRightWidth = max<LayoutUnit>(-outlineStyle->outlin
eOffset(), borderWidth + minInsetRightShadowExtent) + max<LayoutUnit>(outlineWid
th, shadowRight); |
1767 LayoutRect rightRect(newBounds.x() + min(newBounds.width(), oldBounds.wi
dth()) - decorationsLeftWidth, | 1767 LayoutRect rightRect(newBounds.x() + min(newBounds.width(), oldBounds.wi
dth()) - decorationsLeftWidth, |
1768 newBounds.y(), | 1768 newBounds.y(), |
1769 width + decorationsLeftWidth + decorationsRightWidth, | 1769 width + decorationsLeftWidth + decorationsRightWidth, |
1770 max(newBounds.height(), oldBounds.height())); | 1770 max(newBounds.height(), oldBounds.height())); |
1771 LayoutUnit right = min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX()); | 1771 LayoutUnit right = min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX()); |
1772 if (rightRect.x() < right) { | 1772 if (rightRect.x() < right) { |
1773 rightRect.setWidth(min(rightRect.width(), right - rightRect.x())); | 1773 rightRect.setWidth(min(rightRect.width(), right - rightRect.x())); |
1774 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(rightRec
t), invalidationReason); | 1774 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnapp
edIntRect(rightRect), invalidationReason); |
1775 } | 1775 } |
1776 } | 1776 } |
1777 LayoutUnit height = absoluteValue(newBounds.height() - oldBounds.height()); | 1777 LayoutUnit height = absoluteValue(newBounds.height() - oldBounds.height()); |
1778 if (height) { | 1778 if (height) { |
1779 LayoutUnit shadowTop; | 1779 LayoutUnit shadowTop; |
1780 LayoutUnit shadowBottom; | 1780 LayoutUnit shadowBottom; |
1781 style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom); | 1781 style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom); |
1782 int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0; | 1782 int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0; |
1783 LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : LayoutUni
t(); | 1783 LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : LayoutUni
t(); |
1784 LayoutUnit minInsetBottomShadowExtent = min<LayoutUnit>(-insetShadowExte
nt.bottom(), min<LayoutUnit>(newBounds.height(), oldBounds.height())); | 1784 LayoutUnit minInsetBottomShadowExtent = min<LayoutUnit>(-insetShadowExte
nt.bottom(), min<LayoutUnit>(newBounds.height(), oldBounds.height())); |
1785 LayoutUnit borderHeight = max<LayoutUnit>(borderBottom, max<LayoutUnit>(
valueForLength(style()->borderBottomLeftRadius().height(), boxHeight), valueForL
ength(style()->borderBottomRightRadius().height(), boxHeight))); | 1785 LayoutUnit borderHeight = max<LayoutUnit>(borderBottom, max<LayoutUnit>(
valueForLength(style()->borderBottomLeftRadius().height(), boxHeight), valueForL
ength(style()->borderBottomRightRadius().height(), boxHeight))); |
1786 LayoutUnit decorationsTopHeight = max<LayoutUnit>(-outlineStyle->outline
Offset(), borderHeight + minInsetBottomShadowExtent) + max<LayoutUnit>(outlineWi
dth, -shadowTop); | 1786 LayoutUnit decorationsTopHeight = max<LayoutUnit>(-outlineStyle->outline
Offset(), borderHeight + minInsetBottomShadowExtent) + max<LayoutUnit>(outlineWi
dth, -shadowTop); |
1787 LayoutUnit decorationsBottomHeight = max<LayoutUnit>(-outlineStyle->outl
ineOffset(), borderHeight + minInsetBottomShadowExtent) + max<LayoutUnit>(outlin
eWidth, shadowBottom); | 1787 LayoutUnit decorationsBottomHeight = max<LayoutUnit>(-outlineStyle->outl
ineOffset(), borderHeight + minInsetBottomShadowExtent) + max<LayoutUnit>(outlin
eWidth, shadowBottom); |
1788 LayoutRect bottomRect(newBounds.x(), | 1788 LayoutRect bottomRect(newBounds.x(), |
1789 min(newBounds.maxY(), oldBounds.maxY()) - decorationsTopHeight, | 1789 min(newBounds.maxY(), oldBounds.maxY()) - decorationsTopHeight, |
1790 max(newBounds.width(), oldBounds.width()), | 1790 max(newBounds.width(), oldBounds.width()), |
1791 height + decorationsTopHeight + decorationsBottomHeight); | 1791 height + decorationsTopHeight + decorationsBottomHeight); |
1792 LayoutUnit bottom = min(newBounds.maxY(), oldBounds.maxY()); | 1792 LayoutUnit bottom = min(newBounds.maxY(), oldBounds.maxY()); |
1793 if (bottomRect.y() < bottom) { | 1793 if (bottomRect.y() < bottom) { |
1794 bottomRect.setHeight(min(bottomRect.height(), bottom - bottomRect.y(
))); | 1794 bottomRect.setHeight(min(bottomRect.height(), bottom - bottomRect.y(
))); |
1795 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(bottomRe
ct), invalidationReason); | 1795 invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnapp
edIntRect(bottomRect), invalidationReason); |
1796 } | 1796 } |
1797 } | 1797 } |
1798 return false; | 1798 return false; |
1799 } | 1799 } |
1800 | 1800 |
1801 void RenderObject::repaintOverflow() | 1801 void RenderObject::invalidatePaintForOverflow() |
1802 { | 1802 { |
1803 } | 1803 } |
1804 | 1804 |
1805 void RenderObject::repaintOverflowIfNeeded() | 1805 void RenderObject::invalidatePaintForOverflowIfNeeded() |
1806 { | 1806 { |
1807 if (shouldInvalidateOverflowForPaint()) | 1807 if (shouldInvalidateOverflowForPaint()) |
1808 repaintOverflow(); | 1808 invalidatePaintForOverflow(); |
1809 } | 1809 } |
1810 | 1810 |
1811 bool RenderObject::checkForRepaint() const | 1811 bool RenderObject::checkForRepaint() const |
1812 { | 1812 { |
1813 return !document().view()->needsFullPaintInvalidation() && everHadLayout(); | 1813 return !document().view()->needsFullPaintInvalidation() && everHadLayout(); |
1814 } | 1814 } |
1815 | 1815 |
1816 bool RenderObject::checkForRepaintDuringLayout() const | 1816 bool RenderObject::checkForRepaintDuringLayout() const |
1817 { | 1817 { |
1818 return !RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && checkForRepai
nt(); | 1818 return !RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && checkForRepai
nt(); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2159 if (isBox()) | 2159 if (isBox()) |
2160 toRenderBox(this)->updateLayerTransform(); | 2160 toRenderBox(this)->updateLayerTransform(); |
2161 } | 2161 } |
2162 | 2162 |
2163 if (updatedDiff.needsRepaint()) { | 2163 if (updatedDiff.needsRepaint()) { |
2164 // Repaint with the new style, e.g., for example if we go from not havin
g | 2164 // Repaint with the new style, e.g., for example if we go from not havin
g |
2165 // an outline to having an outline. | 2165 // an outline to having an outline. |
2166 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && needsLayout()
) | 2166 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && needsLayout()
) |
2167 setShouldDoFullPaintInvalidationAfterLayout(true); | 2167 setShouldDoFullPaintInvalidationAfterLayout(true); |
2168 else if (!selfNeedsLayout()) | 2168 else if (!selfNeedsLayout()) |
2169 repaint(); | 2169 paintInvalidationForWholeRenderer(); |
2170 } | 2170 } |
2171 } | 2171 } |
2172 | 2172 |
2173 static inline bool rendererHasBackground(const RenderObject* renderer) | 2173 static inline bool rendererHasBackground(const RenderObject* renderer) |
2174 { | 2174 { |
2175 return renderer && renderer->hasBackground(); | 2175 return renderer && renderer->hasBackground(); |
2176 } | 2176 } |
2177 | 2177 |
2178 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS
tyle) | 2178 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS
tyle) |
2179 { | 2179 { |
(...skipping 11 matching lines...) Expand all Loading... |
2191 | 2191 |
2192 // Keep layer hierarchy visibility bits up to date if visibility changes
. | 2192 // Keep layer hierarchy visibility bits up to date if visibility changes
. |
2193 if (m_style->visibility() != newStyle.visibility()) { | 2193 if (m_style->visibility() != newStyle.visibility()) { |
2194 // We might not have an enclosing layer yet because we might not be
in the tree. | 2194 // We might not have an enclosing layer yet because we might not be
in the tree. |
2195 if (RenderLayer* layer = enclosingLayer()) { | 2195 if (RenderLayer* layer = enclosingLayer()) { |
2196 if (newStyle.visibility() == VISIBLE) { | 2196 if (newStyle.visibility() == VISIBLE) { |
2197 layer->setHasVisibleContent(); | 2197 layer->setHasVisibleContent(); |
2198 } else if (layer->hasVisibleContent() && (this == layer->rendere
r() || layer->renderer()->style()->visibility() != VISIBLE)) { | 2198 } else if (layer->hasVisibleContent() && (this == layer->rendere
r() || layer->renderer()->style()->visibility() != VISIBLE)) { |
2199 layer->dirtyVisibleContentStatus(); | 2199 layer->dirtyVisibleContentStatus(); |
2200 if (diff.needsLayout()) | 2200 if (diff.needsLayout()) |
2201 repaint(); | 2201 paintInvalidationForWholeRenderer(); |
2202 } | 2202 } |
2203 } | 2203 } |
2204 } | 2204 } |
2205 | 2205 |
2206 if (m_parent && diff.needsRepaintObject()) { | 2206 if (m_parent && diff.needsRepaintObject()) { |
2207 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && (diff.nee
dsLayout() || needsLayout())) | 2207 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && (diff.nee
dsLayout() || needsLayout())) |
2208 setShouldDoFullPaintInvalidationAfterLayout(true); | 2208 setShouldDoFullPaintInvalidationAfterLayout(true); |
2209 else if (!diff.needsFullLayout() && !selfNeedsLayout()) | 2209 else if (!diff.needsFullLayout() && !selfNeedsLayout()) |
2210 repaint(); | 2210 paintInvalidationForWholeRenderer(); |
2211 } | 2211 } |
2212 | 2212 |
2213 if (isFloating() && (m_style->floating() != newStyle.floating())) | 2213 if (isFloating() && (m_style->floating() != newStyle.floating())) |
2214 // For changes in float styles, we need to conceivably remove oursel
ves | 2214 // For changes in float styles, we need to conceivably remove oursel
ves |
2215 // from the floating objects list. | 2215 // from the floating objects list. |
2216 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); | 2216 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); |
2217 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos
ition())) | 2217 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos
ition())) |
2218 // For changes in positioning styles, we need to conceivably remove
ourselves | 2218 // For changes in positioning styles, we need to conceivably remove
ourselves |
2219 // from the positioned objects list. | 2219 // from the positioned objects list. |
2220 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); | 2220 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3551 { | 3551 { |
3552 if (object1) { | 3552 if (object1) { |
3553 const WebCore::RenderObject* root = object1; | 3553 const WebCore::RenderObject* root = object1; |
3554 while (root->parent()) | 3554 while (root->parent()) |
3555 root = root->parent(); | 3555 root = root->parent(); |
3556 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3556 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3557 } | 3557 } |
3558 } | 3558 } |
3559 | 3559 |
3560 #endif | 3560 #endif |
OLD | NEW |