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 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 } | 1475 } |
1476 return false; | 1476 return false; |
1477 } | 1477 } |
1478 | 1478 |
1479 bool LayoutBox::intersectsVisibleViewport() | 1479 bool LayoutBox::intersectsVisibleViewport() |
1480 { | 1480 { |
1481 LayoutRect rect = visualOverflowRect(); | 1481 LayoutRect rect = visualOverflowRect(); |
1482 LayoutView* layoutView = view(); | 1482 LayoutView* layoutView = view(); |
1483 while (layoutView->frame()->ownerLayoutObject()) | 1483 while (layoutView->frame()->ownerLayoutObject()) |
1484 layoutView = layoutView->frame()->ownerLayoutObject()->view(); | 1484 layoutView = layoutView->frame()->ownerLayoutObject()->view(); |
1485 mapToVisibleRectInAncestorSpace(layoutView, rect, nullptr); | 1485 mapToVisibleRectInAncestorSpace(layoutView, rect); |
1486 return rect.intersects(LayoutRect(layoutView->frameView()->getScrollableArea
()->visibleContentRectDouble())); | 1486 return rect.intersects(LayoutRect(layoutView->frameView()->getScrollableArea
()->visibleContentRectDouble())); |
1487 } | 1487 } |
1488 | 1488 |
1489 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(const PaintInvalidati
onState& paintInvalidationState) | 1489 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(const PaintInvalidati
onState& paintInvalidationState) |
1490 { | 1490 { |
1491 if (isFloating()) | 1491 if (isFloating()) |
1492 paintInvalidationState.enclosingSelfPaintingLayer(*this).setNeedsPaintPh
aseFloat(); | 1492 paintInvalidationState.enclosingSelfPaintingLayer(*this).setNeedsPaintPh
aseFloat(); |
1493 | 1493 |
1494 if (hasBoxDecorationBackground() | 1494 if (hasBoxDecorationBackground() |
1495 // We also paint overflow controls in background phase. | 1495 // We also paint overflow controls in background phase. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1676 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); | 1676 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); |
1677 if (fillAvailableExtent == -1) | 1677 if (fillAvailableExtent == -1) |
1678 return fillFallbackExtent; | 1678 return fillFallbackExtent; |
1679 return std::min(fillAvailableExtent, fillFallbackExtent); | 1679 return std::min(fillAvailableExtent, fillFallbackExtent); |
1680 } | 1680 } |
1681 | 1681 |
1682 // Use the content box logical height as specified by the style. | 1682 // Use the content box logical height as specified by the style. |
1683 return cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(logicalHeigh
tLength.value())); | 1683 return cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(logicalHeigh
tLength.value())); |
1684 } | 1684 } |
1685 | 1685 |
1686 void LayoutBox::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transfo
rmState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const PaintIn
validationState* paintInvalidationState) const | 1686 void LayoutBox::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transfo
rmState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const |
1687 { | 1687 { |
1688 bool isFixedPos = style()->position() == FixedPosition; | 1688 bool isFixedPos = style()->position() == FixedPosition; |
1689 bool hasTransform = hasLayer() && layer()->transform(); | 1689 bool hasTransform = hasLayer() && layer()->transform(); |
1690 // If this box has a transform, it acts as a fixed position container for fi
xed descendants, | 1690 // If this box has a transform, it acts as a fixed position container for fi
xed descendants, |
1691 // and may itself also be fixed position. So propagate 'fixed' up only if th
is box is fixed position. | 1691 // and may itself also be fixed position. So propagate 'fixed' up only if th
is box is fixed position. |
1692 if (hasTransform && !isFixedPos) | 1692 if (hasTransform && !isFixedPos) |
1693 mode &= ~IsFixed; | 1693 mode &= ~IsFixed; |
1694 else if (isFixedPos) | 1694 else if (isFixedPos) |
1695 mode |= IsFixed; | 1695 mode |= IsFixed; |
1696 | 1696 |
1697 LayoutBoxModelObject::mapLocalToAncestor(ancestor, transformState, mode, was
Fixed, paintInvalidationState); | 1697 LayoutBoxModelObject::mapLocalToAncestor(ancestor, transformState, mode, was
Fixed); |
1698 } | 1698 } |
1699 | 1699 |
1700 void LayoutBox::mapAncestorToLocal(const LayoutBoxModelObject* ancestor, Transfo
rmState& transformState, MapCoordinatesFlags mode) const | 1700 void LayoutBox::mapAncestorToLocal(const LayoutBoxModelObject* ancestor, Transfo
rmState& transformState, MapCoordinatesFlags mode) const |
1701 { | 1701 { |
1702 if (this == ancestor) | 1702 if (this == ancestor) |
1703 return; | 1703 return; |
1704 | 1704 |
1705 bool isFixedPos = style()->position() == FixedPosition; | 1705 bool isFixedPos = style()->position() == FixedPosition; |
1706 bool hasTransform = hasLayer() && layer()->transform(); | 1706 bool hasTransform = hasLayer() && layer()->transform(); |
1707 if (hasTransform && !isFixedPos) { | 1707 if (hasTransform && !isFixedPos) { |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1928 if (style()->visibility() != VISIBLE) { | 1928 if (style()->visibility() != VISIBLE) { |
1929 PaintLayer* layer = enclosingLayer(); | 1929 PaintLayer* layer = enclosingLayer(); |
1930 layer->updateDescendantDependentFlags(); | 1930 layer->updateDescendantDependentFlags(); |
1931 if (layer->subtreeIsInvisible()) | 1931 if (layer->subtreeIsInvisible()) |
1932 return LayoutRect(); | 1932 return LayoutRect(); |
1933 } | 1933 } |
1934 | 1934 |
1935 return visualOverflowRect(); | 1935 return visualOverflowRect(); |
1936 } | 1936 } |
1937 | 1937 |
1938 bool LayoutBox::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ance
stor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState, Vi
sibleRectFlags visibleRectFlags) const | 1938 bool LayoutBox::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ance
stor, LayoutRect& rect, VisibleRectFlags visibleRectFlags) const |
1939 { | 1939 { |
1940 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. | 1940 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. |
1941 // Only when we cross a writing mode boundary will we have to possibly flipF
orWritingMode (to convert into a more appropriate | 1941 // Only when we cross a writing mode boundary will we have to possibly flipF
orWritingMode (to convert into a more appropriate |
1942 // offset corner for the enclosing container). This allows for a fully RL or
BT document to issue paint invalidations | 1942 // offset corner for the enclosing container). This allows for a fully RL or
BT document to issue paint invalidations |
1943 // properly even during layout, since the rect remains flipped all the way u
ntil the end. | 1943 // properly even during layout, since the rect remains flipped all the way u
ntil the end. |
1944 // | 1944 // |
1945 // LayoutView::computeRectForPaintInvalidation then converts the rect to phy
sical coordinates. We also convert to | 1945 // LayoutView::computeRectForPaintInvalidation then converts the rect to phy
sical coordinates. We also convert to |
1946 // physical when we hit a paintInvalidationContainer boundary. Therefore the
final rect returned is always in the | 1946 // physical when we hit the ancestor. Therefore the final rect returned is a
lways in the |
1947 // physical coordinate space of the paintInvalidationContainer. | 1947 // physical coordinate space of the ancestor. |
1948 const ComputedStyle& styleToUse = styleRef(); | 1948 const ComputedStyle& styleToUse = styleRef(); |
1949 | 1949 |
1950 EPosition position = styleToUse.position(); | 1950 EPosition position = styleToUse.position(); |
1951 | 1951 |
1952 // We need to inflate the paint invalidation rect before we use paintInvalid
ationState, | 1952 // We need to inflate the paint invalidation rect before we use paintInvalid
ationState, |
1953 // else we would forget to inflate it for the current layoutObject. FIXME: I
f these were | 1953 // else we would forget to inflate it for the current layoutObject. FIXME: I
f these were |
1954 // included into the visual overflow for repaint, we wouldn't have this issu
e. | 1954 // included into the visual overflow for paint invalidation, we wouldn't hav
e this issue. |
1955 inflatePaintInvalidationRectForReflectionAndFilter(rect); | 1955 inflatePaintInvalidationRectForReflectionAndFilter(rect); |
1956 | 1956 |
1957 if (paintInvalidationState && paintInvalidationState->canMapToAncestor(ances
tor) && position != FixedPosition) { | |
1958 return paintInvalidationState->mapObjectRectToAncestor(*this, ancestor,
rect, visibleRectFlags); | |
1959 } | |
1960 | |
1961 if (ancestor == this) { | 1957 if (ancestor == this) { |
1962 if (ancestor->style()->isFlippedBlocksWritingMode()) | 1958 if (ancestor->style()->isFlippedBlocksWritingMode()) |
1963 flipForWritingMode(rect); | 1959 flipForWritingMode(rect); |
1964 return true; | 1960 return true; |
1965 } | 1961 } |
1966 | 1962 |
1967 bool containerSkipped; | 1963 bool containerSkipped; |
1968 LayoutObject* container = this->container(ancestor, &containerSkipped); | 1964 LayoutObject* container = this->container(ancestor, &containerSkipped); |
1969 if (!container) | 1965 if (!container) |
1970 return true; | 1966 return true; |
(...skipping 30 matching lines...) Expand all Loading... |
2001 containerBox->mapScrollingContentsRectToBoxSpace(rect); | 1997 containerBox->mapScrollingContentsRectToBoxSpace(rect); |
2002 if (container != ancestor && !containerBox->applyOverflowClip(rect, visi
bleRectFlags)) | 1998 if (container != ancestor && !containerBox->applyOverflowClip(rect, visi
bleRectFlags)) |
2003 return false; | 1999 return false; |
2004 } | 2000 } |
2005 | 2001 |
2006 if (containerSkipped) { | 2002 if (containerSkipped) { |
2007 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. | 2003 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. |
2008 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta
iner); | 2004 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta
iner); |
2009 rect.move(-containerOffset); | 2005 rect.move(-containerOffset); |
2010 // If the paintInvalidationContainer is fixed, then the rect is already
in its coordinates so doesn't need viewport-adjusting. | 2006 // If the paintInvalidationContainer is fixed, then the rect is already
in its coordinates so doesn't need viewport-adjusting. |
2011 if (ancestor->style()->position() != FixedPosition && container->isLayou
tView()) | 2007 if (ancestor->style()->position() != FixedPosition && container->isLayou
tView() && position == FixedPosition) |
2012 toLayoutView(container)->adjustViewportConstrainedOffset(rect, Layou
tView::toViewportConstrainedPosition(position)); | 2008 toLayoutView(container)->adjustOffsetForFixedPosition(rect); |
2013 return true; | 2009 return true; |
2014 } | 2010 } |
2015 | 2011 |
2016 if (container->isLayoutView()) | 2012 if (container->isLayoutView()) |
2017 return toLayoutView(container)->mapToVisibleRectInAncestorSpace(ancestor
, rect, LayoutView::toViewportConstrainedPosition(position), nullptr, visibleRec
tFlags); | 2013 return toLayoutView(container)->mapToVisibleRectInAncestorSpace(ancestor
, rect, position == FixedPosition ? IsFixed : 0, visibleRectFlags); |
2018 else | 2014 else |
2019 return container->mapToVisibleRectInAncestorSpace(ancestor, rect, nullpt
r, visibleRectFlags); | 2015 return container->mapToVisibleRectInAncestorSpace(ancestor, rect, visibl
eRectFlags); |
2020 } | 2016 } |
2021 | 2017 |
2022 void LayoutBox::inflatePaintInvalidationRectForReflectionAndFilter(LayoutRect& p
aintInvalidationRect) const | 2018 void LayoutBox::inflatePaintInvalidationRectForReflectionAndFilter(LayoutRect& p
aintInvalidationRect) const |
2023 { | 2019 { |
2024 if (hasReflection()) | 2020 if (hasReflection()) |
2025 paintInvalidationRect.unite(reflectedRect(paintInvalidationRect)); | 2021 paintInvalidationRect.unite(reflectedRect(paintInvalidationRect)); |
2026 | 2022 |
2027 if (layer() && layer()->hasFilter()) | 2023 if (layer() && layer()->hasFilter()) |
2028 paintInvalidationRect.expand(layer()->filterOutsets()); | 2024 paintInvalidationRect.expand(layer()->filterOutsets()); |
2029 } | 2025 } |
(...skipping 2677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4707 | 4703 |
4708 void LayoutBox::clearPercentHeightDescendants() | 4704 void LayoutBox::clearPercentHeightDescendants() |
4709 { | 4705 { |
4710 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde
r(this)) { | 4706 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde
r(this)) { |
4711 if (curr->isBox()) | 4707 if (curr->isBox()) |
4712 toLayoutBox(curr)->removeFromPercentHeightContainer(); | 4708 toLayoutBox(curr)->removeFromPercentHeightContainer(); |
4713 } | 4709 } |
4714 } | 4710 } |
4715 | 4711 |
4716 } // namespace blink | 4712 } // namespace blink |
OLD | NEW |