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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 } | 1538 } |
1539 | 1539 |
1540 layerRenderer->invalidatePaintRectangle(geometry.destRect()); | 1540 layerRenderer->invalidatePaintRectangle(geometry.destRect()); |
1541 if (geometry.destRect() == rendererRect) | 1541 if (geometry.destRect() == rendererRect) |
1542 return true; | 1542 return true; |
1543 } | 1543 } |
1544 } | 1544 } |
1545 return false; | 1545 return false; |
1546 } | 1546 } |
1547 | 1547 |
1548 void RenderBox::invalidateTreeAfterLayout(const PaintInvalidationState& paintInv
alidationState) | 1548 void RenderBox::invalidateTreeAfterLayout(const RenderLayerModelObject& paintInv
alidationContainer) |
1549 { | 1549 { |
1550 // FIXME: Currently only using this logic for RenderBox and its ilk. Ideally
, RenderBlockFlows with | 1550 // FIXME: Currently only using this logic for RenderBox and its ilk. Ideally
, RenderBlockFlows with |
1551 // inline children should track a dirty rect in local coordinates for dirty
lines instead of invalidating | 1551 // inline children should track a dirty rect in local coordinates for dirty
lines instead of invalidating |
1552 // the world. | 1552 // the world. |
1553 // FIXME: We should still be recursing through inline's children, as they ca
n have boxes, but we don't | 1553 // FIXME: We should still be recursing through inline's children, as they ca
n have boxes, but we don't |
1554 // appear to have tests for this? | 1554 // appear to have tests for this? |
1555 // FIXME: SVG should probably also go through this unified paint invalidatio
n system. | 1555 // FIXME: SVG should probably also go through this unified paint invalidatio
n system. |
1556 ASSERT(!needsLayout()); | 1556 ASSERT(!needsLayout()); |
1557 | 1557 |
1558 if (!shouldCheckForPaintInvalidationAfterLayout()) | 1558 if (!shouldCheckForPaintInvalidationAfterLayout()) |
1559 return; | 1559 return; |
1560 | 1560 |
1561 bool establishesNewPaintInvalidationContainer = isPaintInvalidationContainer
(); | 1561 bool establishesNewPaintInvalidationContainer = isPaintInvalidationContainer
(); |
1562 const RenderLayerModelObject& newPaintInvalidationContainer = *adjustComposi
tedContainerForSpecialAncestors(establishesNewPaintInvalidationContainer ? this
: &paintInvalidationState.paintInvalidationContainer()); | 1562 const RenderLayerModelObject& newPaintInvalidationContainer = *adjustComposi
tedContainerForSpecialAncestors(establishesNewPaintInvalidationContainer ? this
: &paintInvalidationContainer); |
1563 // FIXME: This assert should be re-enabled when we move paint invalidation t
o after compositing update. crbug.com/360286 | 1563 // FIXME: This assert should be re-enabled when we move paint invalidation t
o after compositing update. crbug.com/360286 |
1564 // ASSERT(&newPaintInvalidationContainer == containerForPaintInvalidation())
; | 1564 // ASSERT(&newPaintInvalidationContainer == containerForPaintInvalidation())
; |
1565 | 1565 |
1566 const LayoutRect oldPaintInvalidationRect = previousPaintInvalidationRect(); | 1566 const LayoutRect oldPaintInvalidationRect = previousPaintInvalidationRect(); |
1567 const LayoutPoint oldPositionFromPaintInvalidationContainer = previousPositi
onFromPaintInvalidationContainer(); | 1567 const LayoutPoint oldPositionFromPaintInvalidationContainer = previousPositi
onFromPaintInvalidationContainer(); |
1568 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(&newPaintInv
alidationContainer, &paintInvalidationState)); | 1568 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(&newPaintInv
alidationContainer)); |
1569 setPreviousPositionFromPaintInvalidationContainer(RenderLayer::positionFromP
aintInvalidationContainer(this, &newPaintInvalidationContainer, &paintInvalidati
onState)); | 1569 setPreviousPositionFromPaintInvalidationContainer(RenderLayer::positionFromP
aintInvalidationContainer(this, &newPaintInvalidationContainer)); |
1570 | 1570 |
1571 // If we are set to do a full paint invalidation that means the RenderView w
ill be | 1571 // If we are set to do a full paint invalidation that means the RenderView w
ill be |
1572 // issue paint invalidations. We can then skip issuing of paint invalidation
s for the child | 1572 // issue paint invalidations. We can then skip issuing of paint invalidation
s for the child |
1573 // renderers as they'll be covered by the RenderView. | 1573 // renderers as they'll be covered by the RenderView. |
1574 if (view()->doingFullRepaint()) { | 1574 if (view()->doingFullRepaint()) { |
1575 PaintInvalidationState childTreeWalkState(paintInvalidationState, *this,
newPaintInvalidationContainer); | 1575 LayoutState state(*this, isTableRow() ? LayoutSize() : locationOffset())
; |
1576 RenderObject::invalidateTreeAfterLayout(childTreeWalkState); | 1576 RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer); |
1577 return; | 1577 return; |
1578 } | 1578 } |
1579 | 1579 |
1580 if ((onlyNeededPositionedMovementLayout() && compositingState() != PaintsInt
oOwnBacking) | 1580 if ((onlyNeededPositionedMovementLayout() && compositingState() != PaintsInt
oOwnBacking) |
1581 || (shouldDoFullPaintInvalidationIfSelfPaintingLayer() | 1581 || (shouldDoFullPaintInvalidationIfSelfPaintingLayer() |
1582 && hasLayer() | 1582 && hasLayer() |
1583 && layer()->isSelfPaintingLayer())) { | 1583 && layer()->isSelfPaintingLayer())) { |
1584 setShouldDoFullPaintInvalidationAfterLayout(true); | 1584 setShouldDoFullPaintInvalidationAfterLayout(true); |
1585 } | 1585 } |
1586 | 1586 |
1587 if (!invalidatePaintIfNeeded(newPaintInvalidationContainer, oldPaintInvalida
tionRect, oldPositionFromPaintInvalidationContainer)) | 1587 if (!invalidatePaintIfNeeded(&newPaintInvalidationContainer, oldPaintInvalid
ationRect, oldPositionFromPaintInvalidationContainer)) |
1588 invalidatePaintForOverflowIfNeeded(); | 1588 invalidatePaintForOverflowIfNeeded(); |
1589 | 1589 |
1590 // Issue paint invalidations for any scrollbars if there is a scrollable are
a for this renderer. | 1590 // Issue paint invalidations for any scrollbars if there is a scrollable are
a for this renderer. |
1591 if (enclosingLayer()) { | 1591 if (enclosingLayer()) { |
1592 if (RenderLayerScrollableArea* area = enclosingLayer()->scrollableArea()
) { | 1592 if (RenderLayerScrollableArea* area = enclosingLayer()->scrollableArea()
) { |
1593 if (area->hasVerticalBarDamage()) | 1593 if (area->hasVerticalBarDamage()) |
1594 invalidatePaintRectangle(area->verticalBarDamage()); | 1594 invalidatePaintRectangle(area->verticalBarDamage()); |
1595 if (area->hasHorizontalBarDamage()) | 1595 if (area->hasHorizontalBarDamage()) |
1596 invalidatePaintRectangle(area->horizontalBarDamage()); | 1596 invalidatePaintRectangle(area->horizontalBarDamage()); |
1597 area->resetScrollbarDamage(); | 1597 area->resetScrollbarDamage(); |
1598 } | 1598 } |
1599 } | 1599 } |
1600 | 1600 |
1601 PaintInvalidationState childTreeWalkState(paintInvalidationState, *this, new
PaintInvalidationContainer); | 1601 // FIXME: LayoutState should be enabled for other paint invalidation contain
ers than the RenderView. crbug.com/363834 |
1602 RenderObject::invalidateTreeAfterLayout(childTreeWalkState); | 1602 if (establishesNewPaintInvalidationContainer && !isRenderView()) { |
| 1603 ForceHorriblySlowRectMapping slowRectMapping(*this); |
| 1604 RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer); |
| 1605 } else { |
| 1606 // FIXME: This concept of a tree walking state for fast lookups should b
e generalized away from |
| 1607 // just layout. |
| 1608 // FIXME: Table rows shouldn't be special-cased. |
| 1609 LayoutState state(*this, isTableRow() ? LayoutSize() : locationOffset())
; |
| 1610 RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer); |
| 1611 } |
1603 } | 1612 } |
1604 | 1613 |
1605 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu
latedOffset, ContentsClipBehavior contentsClipBehavior) | 1614 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu
latedOffset, ContentsClipBehavior contentsClipBehavior) |
1606 { | 1615 { |
1607 if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == Paint
PhaseSelfOutline || paintInfo.phase == PaintPhaseMask) | 1616 if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == Paint
PhaseSelfOutline || paintInfo.phase == PaintPhaseMask) |
1608 return false; | 1617 return false; |
1609 | 1618 |
1610 bool isControlClip = hasControlClip(); | 1619 bool isControlClip = hasControlClip(); |
1611 bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer(); | 1620 bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer(); |
1612 | 1621 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1773 if (!logicalHeightLength.isFixed()) { | 1782 if (!logicalHeightLength.isFixed()) { |
1774 LayoutUnit fillFallbackExtent = containingBlockStyle->isHorizontalWritin
gMode() ? view()->frameView()->visibleHeight() : view()->frameView()->visibleWid
th(); | 1783 LayoutUnit fillFallbackExtent = containingBlockStyle->isHorizontalWritin
gMode() ? view()->frameView()->visibleHeight() : view()->frameView()->visibleWid
th(); |
1775 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); | 1784 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); |
1776 return std::min(fillAvailableExtent, fillFallbackExtent); | 1785 return std::min(fillAvailableExtent, fillFallbackExtent); |
1777 } | 1786 } |
1778 | 1787 |
1779 // Use the content box logical height as specified by the style. | 1788 // Use the content box logical height as specified by the style. |
1780 return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.val
ue()); | 1789 return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.val
ue()); |
1781 } | 1790 } |
1782 | 1791 |
1783 void RenderBox::mapLocalToContainer(const RenderLayerModelObject* repaintContain
er, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, co
nst PaintInvalidationState* paintInvalidationState) const | 1792 void RenderBox::mapLocalToContainer(const RenderLayerModelObject* repaintContain
er, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) co
nst |
1784 { | 1793 { |
1785 if (repaintContainer == this) | 1794 if (repaintContainer == this) |
1786 return; | 1795 return; |
1787 | 1796 |
1788 if (paintInvalidationState && paintInvalidationState->canMapToContainer(repa
intContainer)) { | 1797 if (RenderView* v = view()) { |
1789 LayoutSize offset = paintInvalidationState->paintOffset() + locationOffs
et(); | 1798 if (v->canMapUsingLayoutStateForContainer(repaintContainer)) { |
1790 if (style()->hasInFlowPosition() && layer()) | 1799 LayoutState* layoutState = v->layoutState(); |
1791 offset += layer()->offsetForInFlowPosition(); | 1800 LayoutSize offset = layoutState->paintOffset() + locationOffset(); |
1792 transformState.move(offset); | 1801 if (style()->hasInFlowPosition() && layer()) |
1793 return; | 1802 offset += layer()->offsetForInFlowPosition(); |
| 1803 transformState.move(offset); |
| 1804 return; |
| 1805 } |
1794 } | 1806 } |
1795 | 1807 |
1796 bool containerSkipped; | 1808 bool containerSkipped; |
1797 RenderObject* o = container(repaintContainer, &containerSkipped); | 1809 RenderObject* o = container(repaintContainer, &containerSkipped); |
1798 if (!o) | 1810 if (!o) |
1799 return; | 1811 return; |
1800 | 1812 |
1801 bool isFixedPos = style()->position() == FixedPosition; | 1813 bool isFixedPos = style()->position() == FixedPosition; |
1802 bool hasTransform = hasLayer() && layer()->transform(); | 1814 bool hasTransform = hasLayer() && layer()->transform(); |
1803 // If this box has a transform, it acts as a fixed position container for fi
xed descendants, | 1815 // If this box has a transform, it acts as a fixed position container for fi
xed descendants, |
(...skipping 24 matching lines...) Expand all Loading... |
1828 return; | 1840 return; |
1829 } | 1841 } |
1830 | 1842 |
1831 mode &= ~ApplyContainerFlip; | 1843 mode &= ~ApplyContainerFlip; |
1832 | 1844 |
1833 o->mapLocalToContainer(repaintContainer, transformState, mode, wasFixed); | 1845 o->mapLocalToContainer(repaintContainer, transformState, mode, wasFixed); |
1834 } | 1846 } |
1835 | 1847 |
1836 void RenderBox::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState
& transformState) const | 1848 void RenderBox::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState
& transformState) const |
1837 { | 1849 { |
| 1850 // We don't expect to be called during layout. |
| 1851 ASSERT(!view() || !view()->layoutStateCachedOffsetsEnabled()); |
| 1852 |
1838 bool isFixedPos = style()->position() == FixedPosition; | 1853 bool isFixedPos = style()->position() == FixedPosition; |
1839 bool hasTransform = hasLayer() && layer()->transform(); | 1854 bool hasTransform = hasLayer() && layer()->transform(); |
1840 if (hasTransform && !isFixedPos) { | 1855 if (hasTransform && !isFixedPos) { |
1841 // If this box has a transform, it acts as a fixed position container fo
r fixed descendants, | 1856 // If this box has a transform, it acts as a fixed position container fo
r fixed descendants, |
1842 // and may itself also be fixed position. So propagate 'fixed' up only i
f this box is fixed position. | 1857 // and may itself also be fixed position. So propagate 'fixed' up only i
f this box is fixed position. |
1843 mode &= ~IsFixed; | 1858 mode &= ~IsFixed; |
1844 } else if (isFixedPos) | 1859 } else if (isFixedPos) |
1845 mode |= IsFixed; | 1860 mode |= IsFixed; |
1846 | 1861 |
1847 RenderBoxModelObject::mapAbsoluteToLocalPoint(mode, transformState); | 1862 RenderBoxModelObject::mapAbsoluteToLocalPoint(mode, transformState); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1945 { | 1960 { |
1946 if (inlineBoxWrapper()) { | 1961 if (inlineBoxWrapper()) { |
1947 if (!documentBeingDestroyed()) | 1962 if (!documentBeingDestroyed()) |
1948 inlineBoxWrapper()->remove(); | 1963 inlineBoxWrapper()->remove(); |
1949 inlineBoxWrapper()->destroy(); | 1964 inlineBoxWrapper()->destroy(); |
1950 ASSERT(m_rareData); | 1965 ASSERT(m_rareData); |
1951 m_rareData->m_inlineBoxWrapper = 0; | 1966 m_rareData->m_inlineBoxWrapper = 0; |
1952 } | 1967 } |
1953 } | 1968 } |
1954 | 1969 |
1955 LayoutRect RenderBox::clippedOverflowRectForPaintInvalidation(const RenderLayerM
odelObject* paintInvalidationContainer, const PaintInvalidationState* paintInval
idationState) const | 1970 LayoutRect RenderBox::clippedOverflowRectForPaintInvalidation(const RenderLayerM
odelObject* paintInvalidationContainer) const |
1956 { | 1971 { |
1957 if (style()->visibility() != VISIBLE && enclosingLayer()->subtreeIsInvisible
()) | 1972 if (style()->visibility() != VISIBLE && enclosingLayer()->subtreeIsInvisible
()) |
1958 return LayoutRect(); | 1973 return LayoutRect(); |
1959 | 1974 |
1960 LayoutRect r = visualOverflowRect(); | 1975 LayoutRect r = visualOverflowRect(); |
1961 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); | 1976 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r); |
1962 return r; | 1977 return r; |
1963 } | 1978 } |
1964 | 1979 |
1965 void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect& rect, bool fixed, const PaintInvalidatio
nState* paintInvalidationState) const | 1980 void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect& rect, bool fixed) const |
1966 { | 1981 { |
1967 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. | 1982 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. |
1968 // Only when we cross a writing mode boundary will we have to possibly flipF
orWritingMode (to convert into a more appropriate | 1983 // Only when we cross a writing mode boundary will we have to possibly flipF
orWritingMode (to convert into a more appropriate |
1969 // offset corner for the enclosing container). This allows for a fully RL o
r BT document to repaint | 1984 // offset corner for the enclosing container). This allows for a fully RL o
r BT document to repaint |
1970 // properly even during layout, since the rect remains flipped all the way u
ntil the end. | 1985 // properly even during layout, since the rect remains flipped all the way u
ntil the end. |
1971 // | 1986 // |
1972 // RenderView::computeRectForRepaint then converts the rect to physical coor
dinates. We also convert to | 1987 // RenderView::computeRectForRepaint then converts the rect to physical coor
dinates. We also convert to |
1973 // physical when we hit a paintInvalidationContainer boundary. Therefore the
final rect returned is always in the | 1988 // physical when we hit a paintInvalidationContainer boundary. Therefore the
final rect returned is always in the |
1974 // physical coordinate space of the paintInvalidationContainer. | 1989 // physical coordinate space of the paintInvalidationContainer. |
1975 RenderStyle* styleToUse = style(); | 1990 RenderStyle* styleToUse = style(); |
| 1991 if (RenderView* v = view()) { |
| 1992 // LayoutState is only valid for root-relative, non-fixed position repai
nting |
| 1993 if (v->canMapUsingLayoutStateForContainer(paintInvalidationContainer) &&
styleToUse->position() != FixedPosition) { |
| 1994 LayoutState* layoutState = v->layoutState(); |
1976 | 1995 |
1977 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer) && styleToUse->position() != FixedPosition) { | 1996 if (layer() && layer()->transform()) |
1978 if (layer() && layer()->transform()) | 1997 rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect)); |
1979 rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect)); | |
1980 | 1998 |
1981 // We can't trust the bits on RenderObject, because this might be called
while re-resolving style. | 1999 // We can't trust the bits on RenderObject, because this might be ca
lled while re-resolving style. |
1982 if (styleToUse->hasInFlowPosition() && layer()) | 2000 if (styleToUse->hasInFlowPosition() && layer()) |
1983 rect.move(layer()->offsetForInFlowPosition()); | 2001 rect.move(layer()->offsetForInFlowPosition()); |
1984 | 2002 |
1985 rect.moveBy(location()); | 2003 rect.moveBy(location()); |
1986 rect.move(paintInvalidationState->paintOffset()); | 2004 rect.move(layoutState->paintOffset()); |
1987 if (paintInvalidationState->isClipped()) | 2005 if (layoutState->isClipped()) |
1988 rect.intersect(paintInvalidationState->clipRect()); | 2006 rect.intersect(layoutState->clipRect()); |
1989 return; | 2007 return; |
| 2008 } |
1990 } | 2009 } |
1991 | 2010 |
1992 if (hasReflection()) | 2011 if (hasReflection()) |
1993 rect.unite(reflectedRect(rect)); | 2012 rect.unite(reflectedRect(rect)); |
1994 | 2013 |
1995 if (paintInvalidationContainer == this) { | 2014 if (paintInvalidationContainer == this) { |
1996 if (paintInvalidationContainer->style()->isFlippedBlocksWritingMode()) | 2015 if (paintInvalidationContainer->style()->isFlippedBlocksWritingMode()) |
1997 flipForWritingMode(rect); | 2016 flipForWritingMode(rect); |
1998 return; | 2017 return; |
1999 } | 2018 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2048 return; | 2067 return; |
2049 } | 2068 } |
2050 | 2069 |
2051 if (containerSkipped) { | 2070 if (containerSkipped) { |
2052 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. | 2071 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. |
2053 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces
torContainer(o); | 2072 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces
torContainer(o); |
2054 rect.move(-containerOffset); | 2073 rect.move(-containerOffset); |
2055 return; | 2074 return; |
2056 } | 2075 } |
2057 | 2076 |
2058 o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, fixed
, paintInvalidationState); | 2077 o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, fixed
); |
2059 } | 2078 } |
2060 | 2079 |
2061 void RenderBox::invalidatePaintForOverhangingFloats(bool) | 2080 void RenderBox::invalidatePaintForOverhangingFloats(bool) |
2062 { | 2081 { |
2063 } | 2082 } |
2064 | 2083 |
2065 void RenderBox::updateLogicalWidth() | 2084 void RenderBox::updateLogicalWidth() |
2066 { | 2085 { |
2067 LogicalExtentComputedValues computedValues; | 2086 LogicalExtentComputedValues computedValues; |
2068 computeLogicalWidth(computedValues); | 2087 computeLogicalWidth(computedValues); |
(...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4013 | 4032 |
4014 // Only auto width objects can possibly shrink to avoid floats. | 4033 // Only auto width objects can possibly shrink to avoid floats. |
4015 return style()->width().isAuto(); | 4034 return style()->width().isAuto(); |
4016 } | 4035 } |
4017 | 4036 |
4018 bool RenderBox::avoidsFloats() const | 4037 bool RenderBox::avoidsFloats() const |
4019 { | 4038 { |
4020 return isReplaced() || hasOverflowClip() || isHR() || isLegend() || isWritin
gModeRoot() || isFlexItemIncludingDeprecated(); | 4039 return isReplaced() || hasOverflowClip() || isHR() || isLegend() || isWritin
gModeRoot() || isFlexItemIncludingDeprecated(); |
4021 } | 4040 } |
4022 | 4041 |
4023 InvalidationReason RenderBox::getPaintInvalidationReason(const RenderLayerModelO
bject& paintInvalidationContainer, | 4042 InvalidationReason RenderBox::getPaintInvalidationReason(const RenderLayerModelO
bject* paintInvalidationContainer, |
4024 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t& newBounds, const LayoutPoint& newLocation) | 4043 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t& newBounds, const LayoutPoint& newLocation) |
4025 { | 4044 { |
4026 InvalidationReason invalidationReason = RenderBoxModelObject::getPaintInvali
dationReason(paintInvalidationContainer, oldBounds, oldLocation, newBounds, newL
ocation); | 4045 InvalidationReason invalidationReason = RenderBoxModelObject::getPaintInvali
dationReason(paintInvalidationContainer, oldBounds, oldLocation, newBounds, newL
ocation); |
4027 if (invalidationReason != InvalidationNone && invalidationReason != Invalida
tionIncremental) | 4046 if (invalidationReason != InvalidationNone && invalidationReason != Invalida
tionIncremental) |
4028 return invalidationReason; | 4047 return invalidationReason; |
4029 | 4048 |
4030 // FIXME: The following checks should use old and new border box rects inste
ad of old and new bounds. | 4049 // FIXME: The following checks should use old and new border box rects inste
ad of old and new bounds. |
4031 | 4050 |
4032 if (style()->hasBorderRadius()) { | 4051 if (style()->hasBorderRadius()) { |
4033 // If a border-radius exists and width/height is smaller than | 4052 // If a border-radius exists and width/height is smaller than |
4034 // radius width/height, we cannot use delta-paint-invalidation. | 4053 // radius width/height, we cannot use delta-paint-invalidation. |
4035 RoundedRect oldRoundedRect = style()->getRoundedBorderFor(oldBounds); | 4054 RoundedRect oldRoundedRect = style()->getRoundedBorderFor(oldBounds); |
4036 RoundedRect newRoundedRect = style()->getRoundedBorderFor(newBounds); | 4055 RoundedRect newRoundedRect = style()->getRoundedBorderFor(newBounds); |
4037 if (oldRoundedRect.radii() != newRoundedRect.radii()) | 4056 if (oldRoundedRect.radii() != newRoundedRect.radii()) |
4038 return InvalidationBorderRadius; | 4057 return InvalidationBorderRadius; |
4039 } | 4058 } |
4040 | 4059 |
4041 if (oldBounds.width() != newBounds.width() && mustInvalidateBackgroundOrBord
erPaintOnWidthChange()) | 4060 if (oldBounds.width() != newBounds.width() && mustInvalidateBackgroundOrBord
erPaintOnWidthChange()) |
4042 return InvalidationBoundsChangeWithBackground; | 4061 return InvalidationBoundsChangeWithBackground; |
4043 if (oldBounds.height() != newBounds.height() && mustInvalidateBackgroundOrBo
rderPaintOnHeightChange()) | 4062 if (oldBounds.height() != newBounds.height() && mustInvalidateBackgroundOrBo
rderPaintOnHeightChange()) |
4044 return InvalidationBoundsChangeWithBackground; | 4063 return InvalidationBoundsChangeWithBackground; |
4045 | 4064 |
4046 return invalidationReason; | 4065 return invalidationReason; |
4047 } | 4066 } |
4048 | 4067 |
4049 void RenderBox::incrementallyInvalidatePaint(const RenderLayerModelObject& paint
InvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds) | 4068 void RenderBox::incrementallyInvalidatePaint(const RenderLayerModelObject* paint
InvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds) |
4050 { | 4069 { |
4051 RenderBoxModelObject::incrementallyInvalidatePaint(paintInvalidationContaine
r, oldBounds, newBounds); | 4070 RenderBoxModelObject::incrementallyInvalidatePaint(paintInvalidationContaine
r, oldBounds, newBounds); |
4052 | 4071 |
4053 if (!style()->hasBorder() && !style()->boxShadow() && !style()->hasBorderIma
geOutsets() && !style()->hasOutline()) | 4072 if (!style()->hasBorder() && !style()->boxShadow() && !style()->hasBorderIma
geOutsets() && !style()->hasOutline()) |
4054 return; | 4073 return; |
4055 | 4074 |
4056 RenderStyle* outlineStyle = this->outlineStyle(); | 4075 RenderStyle* outlineStyle = this->outlineStyle(); |
4057 LayoutUnit outlineWidth = outlineStyle->outlineSize(); | 4076 LayoutUnit outlineWidth = outlineStyle->outlineSize(); |
4058 LayoutBoxExtent insetShadowExtent = style()->getBoxShadowInsetExtent(); | 4077 LayoutBoxExtent insetShadowExtent = style()->getBoxShadowInsetExtent(); |
4059 LayoutUnit deltaWidth = absoluteValue(newBounds.width() - oldBounds.width())
; | 4078 LayoutUnit deltaWidth = absoluteValue(newBounds.width() - oldBounds.width())
; |
4060 if (deltaWidth) { | 4079 if (deltaWidth) { |
4061 LayoutUnit shadowLeft; | 4080 LayoutUnit shadowLeft; |
4062 LayoutUnit shadowRight; | 4081 LayoutUnit shadowRight; |
4063 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight); | 4082 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight); |
4064 LayoutUnit boxWidth = width(); | 4083 LayoutUnit boxWidth = width(); |
4065 LayoutUnit minInsetRightShadowExtent = std::min<LayoutUnit>(-insetShadow
Extent.right(), std::min<LayoutUnit>(newBounds.width(), oldBounds.width())); | 4084 LayoutUnit minInsetRightShadowExtent = std::min<LayoutUnit>(-insetShadow
Extent.right(), std::min<LayoutUnit>(newBounds.width(), oldBounds.width())); |
4066 LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight(), std::max<La
youtUnit>(valueForLength(style()->borderTopRightRadius().width(), boxWidth), val
ueForLength(style()->borderBottomRightRadius().width(), boxWidth))); | 4085 LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight(), std::max<La
youtUnit>(valueForLength(style()->borderTopRightRadius().width(), boxWidth), val
ueForLength(style()->borderBottomRightRadius().width(), boxWidth))); |
4067 LayoutUnit decorationsLeftWidth = std::max<LayoutUnit>(-outlineStyle->ou
tlineOffset(), borderWidth + minInsetRightShadowExtent) + std::max<LayoutUnit>(o
utlineWidth, -shadowLeft); | 4086 LayoutUnit decorationsLeftWidth = std::max<LayoutUnit>(-outlineStyle->ou
tlineOffset(), borderWidth + minInsetRightShadowExtent) + std::max<LayoutUnit>(o
utlineWidth, -shadowLeft); |
4068 LayoutUnit decorationsRightWidth = std::max<LayoutUnit>(-outlineStyle->o
utlineOffset(), borderWidth + minInsetRightShadowExtent) + std::max<LayoutUnit>(
outlineWidth, shadowRight); | 4087 LayoutUnit decorationsRightWidth = std::max<LayoutUnit>(-outlineStyle->o
utlineOffset(), borderWidth + minInsetRightShadowExtent) + std::max<LayoutUnit>(
outlineWidth, shadowRight); |
4069 LayoutRect rightRect(newBounds.x() + std::min(newBounds.width(), oldBoun
ds.width()) - decorationsLeftWidth, | 4088 LayoutRect rightRect(newBounds.x() + std::min(newBounds.width(), oldBoun
ds.width()) - decorationsLeftWidth, |
4070 newBounds.y(), | 4089 newBounds.y(), |
4071 deltaWidth + decorationsLeftWidth + decorationsRightWidth, | 4090 deltaWidth + decorationsLeftWidth + decorationsRightWidth, |
4072 std::max(newBounds.height(), oldBounds.height())); | 4091 std::max(newBounds.height(), oldBounds.height())); |
4073 LayoutUnit right = std::min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX
()); | 4092 LayoutUnit right = std::min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX
()); |
4074 if (rightRect.x() < right) { | 4093 if (rightRect.x() < right) { |
4075 rightRect.setWidth(std::min(rightRect.width(), right - rightRect.x()
)); | 4094 rightRect.setWidth(std::min(rightRect.width(), right - rightRect.x()
)); |
4076 invalidatePaintUsingContainer(&paintInvalidationContainer, rightRect
, InvalidationIncremental); | 4095 invalidatePaintUsingContainer(paintInvalidationContainer, rightRect,
InvalidationIncremental); |
4077 } | 4096 } |
4078 } | 4097 } |
4079 | 4098 |
4080 LayoutUnit deltaHeight = absoluteValue(newBounds.height() - oldBounds.height
()); | 4099 LayoutUnit deltaHeight = absoluteValue(newBounds.height() - oldBounds.height
()); |
4081 if (deltaHeight) { | 4100 if (deltaHeight) { |
4082 LayoutUnit shadowTop; | 4101 LayoutUnit shadowTop; |
4083 LayoutUnit shadowBottom; | 4102 LayoutUnit shadowBottom; |
4084 style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom); | 4103 style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom); |
4085 LayoutUnit boxHeight = height(); | 4104 LayoutUnit boxHeight = height(); |
4086 LayoutUnit minInsetBottomShadowExtent = std::min<LayoutUnit>(-insetShado
wExtent.bottom(), std::min<LayoutUnit>(newBounds.height(), oldBounds.height())); | 4105 LayoutUnit minInsetBottomShadowExtent = std::min<LayoutUnit>(-insetShado
wExtent.bottom(), std::min<LayoutUnit>(newBounds.height(), oldBounds.height())); |
4087 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max<
LayoutUnit>(valueForLength(style()->borderBottomLeftRadius().height(), boxHeight
), valueForLength(style()->borderBottomRightRadius().height(), boxHeight))); | 4106 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max<
LayoutUnit>(valueForLength(style()->borderBottomLeftRadius().height(), boxHeight
), valueForLength(style()->borderBottomRightRadius().height(), boxHeight))); |
4088 LayoutUnit decorationsTopHeight = std::max<LayoutUnit>(-outlineStyle->ou
tlineOffset(), borderHeight + minInsetBottomShadowExtent) + std::max<LayoutUnit>
(outlineWidth, -shadowTop); | 4107 LayoutUnit decorationsTopHeight = std::max<LayoutUnit>(-outlineStyle->ou
tlineOffset(), borderHeight + minInsetBottomShadowExtent) + std::max<LayoutUnit>
(outlineWidth, -shadowTop); |
4089 LayoutUnit decorationsBottomHeight = std::max<LayoutUnit>(-outlineStyle-
>outlineOffset(), borderHeight + minInsetBottomShadowExtent) + std::max<LayoutUn
it>(outlineWidth, shadowBottom); | 4108 LayoutUnit decorationsBottomHeight = std::max<LayoutUnit>(-outlineStyle-
>outlineOffset(), borderHeight + minInsetBottomShadowExtent) + std::max<LayoutUn
it>(outlineWidth, shadowBottom); |
4090 LayoutRect bottomRect(newBounds.x(), | 4109 LayoutRect bottomRect(newBounds.x(), |
4091 std::min(newBounds.maxY(), oldBounds.maxY()) - decorationsTopHeight, | 4110 std::min(newBounds.maxY(), oldBounds.maxY()) - decorationsTopHeight, |
4092 std::max(newBounds.width(), oldBounds.width()), | 4111 std::max(newBounds.width(), oldBounds.width()), |
4093 deltaHeight + decorationsTopHeight + decorationsBottomHeight); | 4112 deltaHeight + decorationsTopHeight + decorationsBottomHeight); |
4094 LayoutUnit bottom = std::min(newBounds.maxY(), oldBounds.maxY()); | 4113 LayoutUnit bottom = std::min(newBounds.maxY(), oldBounds.maxY()); |
4095 if (bottomRect.y() < bottom) { | 4114 if (bottomRect.y() < bottom) { |
4096 bottomRect.setHeight(std::min(bottomRect.height(), bottom - bottomRe
ct.y())); | 4115 bottomRect.setHeight(std::min(bottomRect.height(), bottom - bottomRe
ct.y())); |
4097 invalidatePaintUsingContainer(&paintInvalidationContainer, bottomRec
t, InvalidationIncremental); | 4116 invalidatePaintUsingContainer(paintInvalidationContainer, bottomRect
, InvalidationIncremental); |
4098 } | 4117 } |
4099 } | 4118 } |
4100 } | 4119 } |
4101 | 4120 |
4102 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop
e) | 4121 void RenderBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop
e) |
4103 { | 4122 { |
4104 ASSERT(!needsLayout()); | 4123 ASSERT(!needsLayout()); |
4105 // If fragmentation height has changed, we need to lay out. No need to enter
the renderer if it | 4124 // If fragmentation height has changed, we need to lay out. No need to enter
the renderer if it |
4106 // is childless, though. | 4125 // is childless, though. |
4107 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) | 4126 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4647 return 0; | 4666 return 0; |
4648 | 4667 |
4649 if (!layoutState && !flowThreadContainingBlock()) | 4668 if (!layoutState && !flowThreadContainingBlock()) |
4650 return 0; | 4669 return 0; |
4651 | 4670 |
4652 RenderBlock* containerBlock = containingBlock(); | 4671 RenderBlock* containerBlock = containingBlock(); |
4653 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); | 4672 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); |
4654 } | 4673 } |
4655 | 4674 |
4656 } // namespace WebCore | 4675 } // namespace WebCore |
OLD | NEW |