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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 } | 931 } |
932 | 932 |
933 IntSize LayoutBox::scrolledContentOffset() const | 933 IntSize LayoutBox::scrolledContentOffset() const |
934 { | 934 { |
935 ASSERT(hasOverflowClip()); | 935 ASSERT(hasOverflowClip()); |
936 ASSERT(hasLayer()); | 936 ASSERT(hasLayer()); |
937 // FIXME: Return DoubleSize here. crbug.com/414283. | 937 // FIXME: Return DoubleSize here. crbug.com/414283. |
938 return flooredIntSize(layer()->scrollableArea()->scrollOffset()); | 938 return flooredIntSize(layer()->scrollableArea()->scrollOffset()); |
939 } | 939 } |
940 | 940 |
941 void LayoutBox::applyCachedScrollOffsetForPaintInvalidation(LayoutRect& paintRec
t) const | 941 void LayoutBox::mapScrollingContentsRectToBoxSpace(LayoutRect& rect) const |
942 { | 942 { |
943 ASSERT(hasLayer()); | 943 ASSERT(hasLayer()); |
944 ASSERT(hasOverflowClip()); | 944 ASSERT(hasOverflowClip()); |
945 | 945 |
946 LayoutSize offset = LayoutSize(-scrolledContentOffset()); | 946 LayoutSize offset = LayoutSize(-scrolledContentOffset()); |
947 if (UNLIKELY(hasFlippedBlocksWritingMode())) { | 947 if (UNLIKELY(hasFlippedBlocksWritingMode())) { |
948 if (isHorizontalWritingMode()) | 948 if (isHorizontalWritingMode()) |
949 offset.setHeight(-offset.height()); | 949 offset.setHeight(-offset.height()); |
950 else | 950 else |
951 offset.setWidth(-offset.width()); | 951 offset.setWidth(-offset.width()); |
952 } | 952 } |
953 paintRect.move(offset); | 953 rect.move(offset); |
954 } | 954 } |
955 | 955 |
956 void LayoutBox::applyCachedClipAndScrollOffsetForPaintInvalidation(LayoutRect& p
aintRect) const | 956 void LayoutBox::applyOverflowClip(LayoutRect& rect) const |
957 { | 957 { |
958 ASSERT(hasLayer()); | 958 ASSERT(hasLayer()); |
959 ASSERT(hasOverflowClip()); | 959 ASSERT(hasOverflowClip()); |
960 | 960 |
961 applyCachedScrollOffsetForPaintInvalidation(paintRect); | 961 flipForWritingMode(rect); |
962 flipForWritingMode(paintRect); | |
963 | 962 |
964 // size() is inaccurate if we're in the middle of a layout of this LayoutBox
, so use the | 963 // size() is inaccurate if we're in the middle of a layout of this LayoutBox
, so use the |
965 // layer's size instead. Even if the layer's size is wrong, the layer itself
will issue paint invalidations | 964 // layer's size instead. Even if the layer's size is wrong, the layer itself
will issue paint invalidations |
966 // anyway if its size does change. | 965 // anyway if its size does change. |
967 LayoutRect clipRect(LayoutPoint(), LayoutSize(layer()->size())); | 966 LayoutRect clipRect(LayoutPoint(), LayoutSize(layer()->size())); |
968 paintRect = intersection(paintRect, clipRect); | 967 rect = intersection(rect, clipRect); |
969 flipForWritingMode(paintRect); | 968 flipForWritingMode(rect); |
970 } | 969 } |
971 | 970 |
972 void LayoutBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou
tUnit& maxLogicalWidth) const | 971 void LayoutBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, Layou
tUnit& maxLogicalWidth) const |
973 { | 972 { |
974 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); | 973 minLogicalWidth = minPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); |
975 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); | 974 maxLogicalWidth = maxPreferredLogicalWidth() - borderAndPaddingLogicalWidth(
); |
976 } | 975 } |
977 | 976 |
978 LayoutUnit LayoutBox::minPreferredLogicalWidth() const | 977 LayoutUnit LayoutBox::minPreferredLogicalWidth() const |
979 { | 978 { |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 } | 1445 } |
1447 return false; | 1446 return false; |
1448 } | 1447 } |
1449 | 1448 |
1450 bool LayoutBox::intersectsVisibleViewport() | 1449 bool LayoutBox::intersectsVisibleViewport() |
1451 { | 1450 { |
1452 LayoutRect rect = visualOverflowRect(); | 1451 LayoutRect rect = visualOverflowRect(); |
1453 LayoutView* layoutView = view(); | 1452 LayoutView* layoutView = view(); |
1454 while (layoutView->frame()->ownerLayoutObject()) | 1453 while (layoutView->frame()->ownerLayoutObject()) |
1455 layoutView = layoutView->frame()->ownerLayoutObject()->view(); | 1454 layoutView = layoutView->frame()->ownerLayoutObject()->view(); |
1456 mapToVisibleRectInContainerSpace(layoutView, rect, 0); | 1455 mapToVisibleRectInAncestorSpace(layoutView, rect, nullptr); |
1457 return rect.intersects(LayoutRect(layoutView->frameView()->scrollableArea()-
>visibleContentRectDouble())); | 1456 return rect.intersects(LayoutRect(layoutView->frameView()->scrollableArea()-
>visibleContentRectDouble())); |
1458 } | 1457 } |
1459 | 1458 |
1460 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(PaintInvalidationStat
e& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationContaine
r) | 1459 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(PaintInvalidationStat
e& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationContaine
r) |
1461 { | 1460 { |
1462 PaintInvalidationReason fullInvalidationReason = fullPaintInvalidationReason
(); | 1461 PaintInvalidationReason fullInvalidationReason = fullPaintInvalidationReason
(); |
1463 // If the current paint invalidation reason is PaintInvalidationDelayedFull,
then this paint invalidation can delayed if the | 1462 // If the current paint invalidation reason is PaintInvalidationDelayedFull,
then this paint invalidation can delayed if the |
1464 // LayoutBox in question is not on-screen. The logic to decide whether this
is appropriate exists at the site of the original | 1463 // LayoutBox in question is not on-screen. The logic to decide whether this
is appropriate exists at the site of the original |
1465 // paint invalidation that chose PaintInvalidationDelayedFull. | 1464 // paint invalidation that chose PaintInvalidationDelayedFull. |
1466 if (fullInvalidationReason == PaintInvalidationDelayedFull) { | 1465 if (fullInvalidationReason == PaintInvalidationDelayedFull) { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); | 1633 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); |
1635 if (fillAvailableExtent == -1) | 1634 if (fillAvailableExtent == -1) |
1636 return fillFallbackExtent; | 1635 return fillFallbackExtent; |
1637 return std::min(fillAvailableExtent, fillFallbackExtent); | 1636 return std::min(fillAvailableExtent, fillFallbackExtent); |
1638 } | 1637 } |
1639 | 1638 |
1640 // Use the content box logical height as specified by the style. | 1639 // Use the content box logical height as specified by the style. |
1641 return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.val
ue()); | 1640 return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.val
ue()); |
1642 } | 1641 } |
1643 | 1642 |
1644 void LayoutBox::mapLocalToContainer(const LayoutBoxModelObject* paintInvalidatio
nContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasF
ixed, const PaintInvalidationState* paintInvalidationState) const | 1643 void LayoutBox::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transfo
rmState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const PaintIn
validationState* paintInvalidationState) const |
1645 { | 1644 { |
1646 if (paintInvalidationContainer == this) | 1645 if (ancestor == this) |
1647 return; | 1646 return; |
1648 | 1647 |
1649 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { | 1648 if (paintInvalidationState && paintInvalidationState->canMapToContainer(ance
stor)) { |
1650 LayoutSize offset = paintInvalidationState->paintOffset() + locationOffs
et(); | 1649 LayoutSize offset = paintInvalidationState->paintOffset() + locationOffs
et(); |
1651 if (style()->hasInFlowPosition() && layer()) | 1650 if (style()->hasInFlowPosition() && layer()) |
1652 offset += layer()->offsetForInFlowPosition(); | 1651 offset += layer()->offsetForInFlowPosition(); |
1653 transformState.move(offset); | 1652 transformState.move(offset); |
1654 return; | 1653 return; |
1655 } | 1654 } |
1656 | 1655 |
1657 bool containerSkipped; | 1656 bool ancestorSkipped; |
1658 LayoutObject* o = container(paintInvalidationContainer, &containerSkipped); | 1657 LayoutObject* o = container(ancestor, &ancestorSkipped); |
1659 if (!o) | 1658 if (!o) |
1660 return; | 1659 return; |
1661 | 1660 |
1662 bool isFixedPos = style()->position() == FixedPosition; | 1661 bool isFixedPos = style()->position() == FixedPosition; |
1663 bool hasTransform = hasLayer() && layer()->transform(); | 1662 bool hasTransform = hasLayer() && layer()->transform(); |
1664 // If this box has a transform, it acts as a fixed position container for fi
xed descendants, | 1663 // If this box has a transform, it acts as a fixed position container for fi
xed descendants, |
1665 // and may itself also be fixed position. So propagate 'fixed' up only if th
is box is fixed position. | 1664 // and may itself also be fixed position. So propagate 'fixed' up only if th
is box is fixed position. |
1666 if (hasTransform && !isFixedPos) | 1665 if (hasTransform && !isFixedPos) |
1667 mode &= ~IsFixed; | 1666 mode &= ~IsFixed; |
1668 else if (isFixedPos) | 1667 else if (isFixedPos) |
1669 mode |= IsFixed; | 1668 mode |= IsFixed; |
1670 | 1669 |
1671 if (wasFixed) | 1670 if (wasFixed) |
1672 *wasFixed = mode & IsFixed; | 1671 *wasFixed = mode & IsFixed; |
1673 | 1672 |
1674 LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(trans
formState.mappedPoint())); | 1673 LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(trans
formState.mappedPoint())); |
1675 | 1674 |
1676 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl
e()->preserves3D()); | 1675 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl
e()->preserves3D()); |
1677 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { | 1676 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { |
1678 TransformationMatrix t; | 1677 TransformationMatrix t; |
1679 getTransformFromContainer(o, containerOffset, t); | 1678 getTransformFromContainer(o, containerOffset, t); |
1680 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate
Transform : TransformState::FlattenTransform); | 1679 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate
Transform : TransformState::FlattenTransform); |
1681 } else { | 1680 } else { |
1682 transformState.move(containerOffset.width(), containerOffset.height(), p
reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo
rm); | 1681 transformState.move(containerOffset.width(), containerOffset.height(), p
reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo
rm); |
1683 } | 1682 } |
1684 | 1683 |
1685 if (containerSkipped) { | 1684 if (ancestorSkipped) { |
1686 // There can't be a transform between paintInvalidationContainer and o,
because transforms create containers, so it should be safe | 1685 // There can't be a transform between paintInvalidationContainer and o,
because transforms create containers, so it should be safe |
1687 // to just subtract the delta between the paintInvalidationContainer and
o. | 1686 // to just subtract the delta between the paintInvalidationContainer and
o. |
1688 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces
torContainer(o); | 1687 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(o); |
1689 transformState.move(-containerOffset.width(), -containerOffset.height(),
preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTrans
form); | 1688 transformState.move(-containerOffset.width(), -containerOffset.height(),
preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTrans
form); |
1690 return; | 1689 return; |
1691 } | 1690 } |
1692 | 1691 |
1693 mode &= ~ApplyContainerFlip; | 1692 mode &= ~ApplyContainerFlip; |
1694 | 1693 |
1695 o->mapLocalToContainer(paintInvalidationContainer, transformState, mode, was
Fixed); | 1694 o->mapLocalToAncestor(ancestor, transformState, mode, wasFixed); |
1696 } | 1695 } |
1697 | 1696 |
1698 void LayoutBox::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState
& transformState) const | 1697 void LayoutBox::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState
& transformState) const |
1699 { | 1698 { |
1700 bool isFixedPos = style()->position() == FixedPosition; | 1699 bool isFixedPos = style()->position() == FixedPosition; |
1701 bool hasTransform = hasLayer() && layer()->transform(); | 1700 bool hasTransform = hasLayer() && layer()->transform(); |
1702 if (hasTransform && !isFixedPos) { | 1701 if (hasTransform && !isFixedPos) { |
1703 // If this box has a transform, it acts as a fixed position container fo
r fixed descendants, | 1702 // If this box has a transform, it acts as a fixed position container fo
r fixed descendants, |
1704 // and may itself also be fixed position. So propagate 'fixed' up only i
f this box is fixed position. | 1703 // and may itself also be fixed position. So propagate 'fixed' up only i
f this box is fixed position. |
1705 mode &= ~IsFixed; | 1704 mode &= ~IsFixed; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 LayoutRect LayoutBox::clippedOverflowRectForPaintInvalidation(const LayoutBoxMod
elObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalid
ationState) const | 1875 LayoutRect LayoutBox::clippedOverflowRectForPaintInvalidation(const LayoutBoxMod
elObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalid
ationState) const |
1877 { | 1876 { |
1878 if (style()->visibility() != VISIBLE) { | 1877 if (style()->visibility() != VISIBLE) { |
1879 PaintLayer* layer = enclosingLayer(); | 1878 PaintLayer* layer = enclosingLayer(); |
1880 layer->updateDescendantDependentFlags(); | 1879 layer->updateDescendantDependentFlags(); |
1881 if (layer->subtreeIsInvisible()) | 1880 if (layer->subtreeIsInvisible()) |
1882 return LayoutRect(); | 1881 return LayoutRect(); |
1883 } | 1882 } |
1884 | 1883 |
1885 LayoutRect r = visualOverflowRect(); | 1884 LayoutRect r = visualOverflowRect(); |
1886 mapToVisibleRectInContainerSpace(paintInvalidationContainer, r, paintInvalid
ationState); | 1885 mapToVisibleRectInAncestorSpace(paintInvalidationContainer, r, paintInvalida
tionState); |
1887 return r; | 1886 return r; |
1888 } | 1887 } |
1889 | 1888 |
1890 void LayoutBox::mapToVisibleRectInContainerSpace(const LayoutBoxModelObject* pai
ntInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* paintIn
validationState) const | 1889 void LayoutBox::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ance
stor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState) co
nst |
1891 { | 1890 { |
1892 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. | 1891 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. |
1893 // Only when we cross a writing mode boundary will we have to possibly flipF
orWritingMode (to convert into a more appropriate | 1892 // Only when we cross a writing mode boundary will we have to possibly flipF
orWritingMode (to convert into a more appropriate |
1894 // offset corner for the enclosing container). This allows for a fully RL or
BT document to issue paint invalidations | 1893 // offset corner for the enclosing container). This allows for a fully RL or
BT document to issue paint invalidations |
1895 // properly even during layout, since the rect remains flipped all the way u
ntil the end. | 1894 // properly even during layout, since the rect remains flipped all the way u
ntil the end. |
1896 // | 1895 // |
1897 // LayoutView::computeRectForPaintInvalidation then converts the rect to phy
sical coordinates. We also convert to | 1896 // LayoutView::computeRectForPaintInvalidation then converts the rect to phy
sical coordinates. We also convert to |
1898 // physical when we hit a paintInvalidationContainer boundary. Therefore the
final rect returned is always in the | 1897 // physical when we hit a paintInvalidationContainer boundary. Therefore the
final rect returned is always in the |
1899 // physical coordinate space of the paintInvalidationContainer. | 1898 // physical coordinate space of the paintInvalidationContainer. |
1900 const ComputedStyle& styleToUse = styleRef(); | 1899 const ComputedStyle& styleToUse = styleRef(); |
1901 | 1900 |
1902 EPosition position = styleToUse.position(); | 1901 EPosition position = styleToUse.position(); |
1903 | 1902 |
1904 // We need to inflate the paint invalidation rect before we use paintInvalid
ationState, | 1903 // We need to inflate the paint invalidation rect before we use paintInvalid
ationState, |
1905 // else we would forget to inflate it for the current layoutObject. FIXME: I
f these were | 1904 // else we would forget to inflate it for the current layoutObject. FIXME: I
f these were |
1906 // included into the visual overflow for repaint, we wouldn't have this issu
e. | 1905 // included into the visual overflow for repaint, we wouldn't have this issu
e. |
1907 inflatePaintInvalidationRectForReflectionAndFilter(rect); | 1906 inflatePaintInvalidationRectForReflectionAndFilter(rect); |
1908 | 1907 |
1909 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer) && position != FixedPosition) { | 1908 if (paintInvalidationState && paintInvalidationState->canMapToContainer(ance
stor) && position != FixedPosition) { |
1910 if (layer() && layer()->transform()) | 1909 if (layer() && layer()->transform()) |
1911 rect = LayoutRect(layer()->transform()->mapRect(pixelSnappedIntRect(
rect))); | 1910 rect = LayoutRect(layer()->transform()->mapRect(pixelSnappedIntRect(
rect))); |
1912 | 1911 |
1913 // We can't trust the bits on LayoutObject, because this might be called
while re-resolving style. | 1912 // We can't trust the bits on LayoutObject, because this might be called
while re-resolving style. |
1914 if (styleToUse.hasInFlowPosition() && layer()) | 1913 if (styleToUse.hasInFlowPosition() && layer()) |
1915 rect.move(layer()->offsetForInFlowPosition()); | 1914 rect.move(layer()->offsetForInFlowPosition()); |
1916 | 1915 |
1917 rect.moveBy(location()); | 1916 rect.moveBy(location()); |
1918 rect.move(paintInvalidationState->paintOffset()); | 1917 rect.move(paintInvalidationState->paintOffset()); |
1919 if (paintInvalidationState->isClipped()) | 1918 if (paintInvalidationState->isClipped()) |
1920 rect.intersect(paintInvalidationState->clipRect()); | 1919 rect.intersect(paintInvalidationState->clipRect()); |
1921 return; | 1920 return; |
1922 } | 1921 } |
1923 | 1922 |
1924 if (paintInvalidationContainer == this) { | 1923 if (ancestor == this) { |
1925 if (paintInvalidationContainer->style()->isFlippedBlocksWritingMode()) | 1924 if (ancestor->style()->isFlippedBlocksWritingMode()) |
1926 flipForWritingMode(rect); | 1925 flipForWritingMode(rect); |
1927 return; | 1926 return; |
1928 } | 1927 } |
1929 | 1928 |
1930 bool containerSkipped; | 1929 bool containerSkipped; |
1931 LayoutObject* o = container(paintInvalidationContainer, &containerSkipped); | 1930 LayoutObject* container = this->container(ancestor, &containerSkipped); |
1932 if (!o) | 1931 if (!container) |
1933 return; | 1932 return; |
1934 | 1933 |
1935 if (isWritingModeRoot()) | 1934 if (isWritingModeRoot()) |
1936 flipForWritingMode(rect); | 1935 flipForWritingMode(rect); |
1937 | 1936 |
1938 LayoutPoint topLeft = rect.location(); | 1937 LayoutPoint topLeft = rect.location(); |
1939 topLeft.move(locationOffset()); | 1938 topLeft.move(locationOffset()); |
1940 | 1939 |
1941 // We are now in our parent container's coordinate space. Apply our transfo
rm to obtain a bounding box | 1940 // We are now in our parent container's coordinate space. Apply our transfo
rm to obtain a bounding box |
1942 // in the parent's coordinate space that encloses us. | 1941 // in the parent's coordinate space that encloses us. |
1943 if (hasLayer() && layer()->transform()) { | 1942 if (hasLayer() && layer()->transform()) { |
1944 rect = LayoutRect(layer()->transform()->mapRect(pixelSnappedIntRect(rect
))); | 1943 rect = LayoutRect(layer()->transform()->mapRect(pixelSnappedIntRect(rect
))); |
1945 topLeft = rect.location(); | 1944 topLeft = rect.location(); |
1946 topLeft.move(locationOffset()); | 1945 topLeft.move(locationOffset()); |
1947 } | 1946 } |
1948 | 1947 |
1949 if (position == AbsolutePosition && o->isInFlowPositioned() && o->isLayoutIn
line()) { | 1948 if (position == AbsolutePosition && container->isInFlowPositioned() && conta
iner->isLayoutInline()) { |
1950 topLeft += toLayoutInline(o)->offsetForInFlowPositionedInline(*this); | 1949 topLeft += toLayoutInline(container)->offsetForInFlowPositionedInline(*t
his); |
1951 } else if (styleToUse.hasInFlowPosition() && layer()) { | 1950 } else if (styleToUse.hasInFlowPosition() && layer()) { |
1952 // Apply the relative position offset when invalidating a rectangle. Th
e layer | 1951 // Apply the relative position offset when invalidating a rectangle. Th
e layer |
1953 // is translated, but the layout box isn't, so we need to do this to get
the | 1952 // is translated, but the layout box isn't, so we need to do this to get
the |
1954 // right dirty rect. Since this is called from LayoutObject::setStyle,
the relative position | 1953 // right dirty rect. Since this is called from LayoutObject::setStyle,
the relative position |
1955 // flag on the LayoutObject has been cleared, so use the one on the styl
e(). | 1954 // flag on the LayoutObject has been cleared, so use the one on the styl
e(). |
1956 topLeft += layer()->offsetForInFlowPosition(); | 1955 topLeft += layer()->offsetForInFlowPosition(); |
1957 } | 1956 } |
1958 | 1957 |
1959 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, | 1958 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, |
1960 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. | 1959 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. |
1961 rect.setLocation(topLeft); | 1960 rect.setLocation(topLeft); |
1962 if (o->hasOverflowClip()) { | 1961 if (container->hasOverflowClip()) { |
1963 LayoutBox* containerBox = toLayoutBox(o); | 1962 LayoutBox* containerBox = toLayoutBox(container); |
1964 if (o == paintInvalidationContainer) | 1963 containerBox->mapScrollingContentsRectToBoxSpace(rect); |
1965 containerBox->applyCachedScrollOffsetForPaintInvalidation(rect); | 1964 if (container != ancestor) |
1966 else | 1965 containerBox->applyOverflowClip(rect); |
1967 containerBox->applyCachedClipAndScrollOffsetForPaintInvalidation(rec
t); | |
1968 if (rect.isEmpty()) | 1966 if (rect.isEmpty()) |
1969 return; | 1967 return; |
1970 } | 1968 } |
1971 | 1969 |
1972 if (containerSkipped) { | 1970 if (containerSkipped) { |
1973 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. | 1971 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. |
1974 LayoutSize containerOffset = paintInvalidationContainer->offsetFromAnces
torContainer(o); | 1972 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta
iner); |
1975 rect.move(-containerOffset); | 1973 rect.move(-containerOffset); |
1976 // If the paintInvalidationContainer is fixed, then the rect is already
in its coordinates so doesn't need viewport-adjusting. | 1974 // If the paintInvalidationContainer is fixed, then the rect is already
in its coordinates so doesn't need viewport-adjusting. |
1977 if (paintInvalidationContainer->style()->position() != FixedPosition &&
o->isLayoutView()) | 1975 if (ancestor->style()->position() != FixedPosition && container->isLayou
tView()) |
1978 toLayoutView(o)->adjustViewportConstrainedOffset(rect, LayoutView::v
iewportConstrainedPosition(position)); | 1976 toLayoutView(container)->adjustViewportConstrainedOffset(rect, Layou
tView::viewportConstrainedPosition(position)); |
1979 return; | 1977 return; |
1980 } | 1978 } |
1981 | 1979 |
1982 if (o->isLayoutView()) | 1980 if (container->isLayoutView()) |
1983 toLayoutView(o)->mapToVisibleRectInContainerSpace(paintInvalidationConta
iner, rect, LayoutView::viewportConstrainedPosition(position), paintInvalidation
State); | 1981 toLayoutView(container)->mapToVisibleRectInAncestorSpace(ancestor, rect,
LayoutView::viewportConstrainedPosition(position), paintInvalidationState); |
1984 else | 1982 else |
1985 o->mapToVisibleRectInContainerSpace(paintInvalidationContainer, rect, pa
intInvalidationState); | 1983 container->mapToVisibleRectInAncestorSpace(ancestor, rect, paintInvalida
tionState); |
1986 } | 1984 } |
1987 | 1985 |
1988 void LayoutBox::inflatePaintInvalidationRectForReflectionAndFilter(LayoutRect& p
aintInvalidationRect) const | 1986 void LayoutBox::inflatePaintInvalidationRectForReflectionAndFilter(LayoutRect& p
aintInvalidationRect) const |
1989 { | 1987 { |
1990 if (hasReflection()) | 1988 if (hasReflection()) |
1991 paintInvalidationRect.unite(reflectedRect(paintInvalidationRect)); | 1989 paintInvalidationRect.unite(reflectedRect(paintInvalidationRect)); |
1992 | 1990 |
1993 if (layer() && layer()->hasFilter()) | 1991 if (layer() && layer()->hasFilter()) |
1994 paintInvalidationRect.expand(layer()->filterOutsets()); | 1992 paintInvalidationRect.expand(layer()->filterOutsets()); |
1995 } | 1993 } |
(...skipping 2893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4889 } | 4887 } |
4890 | 4888 |
4891 void LayoutBox::clearPreviousPaintInvalidationRects() | 4889 void LayoutBox::clearPreviousPaintInvalidationRects() |
4892 { | 4890 { |
4893 LayoutBoxModelObject::clearPreviousPaintInvalidationRects(); | 4891 LayoutBoxModelObject::clearPreviousPaintInvalidationRects(); |
4894 if (PaintLayerScrollableArea* scrollableArea = this->scrollableArea()) | 4892 if (PaintLayerScrollableArea* scrollableArea = this->scrollableArea()) |
4895 scrollableArea->clearPreviousPaintInvalidationRects(); | 4893 scrollableArea->clearPreviousPaintInvalidationRects(); |
4896 } | 4894 } |
4897 | 4895 |
4898 } // namespace blink | 4896 } // namespace blink |
OLD | NEW |