| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1916 bool LayoutBox::hasForcedBreakBefore() const | 1916 bool LayoutBox::hasForcedBreakBefore() const |
| 1917 { | 1917 { |
| 1918 return isForcedFragmentainerBreakValue(breakBefore()); | 1918 return isForcedFragmentainerBreakValue(breakBefore()); |
| 1919 } | 1919 } |
| 1920 | 1920 |
| 1921 bool LayoutBox::hasForcedBreakAfter() const | 1921 bool LayoutBox::hasForcedBreakAfter() const |
| 1922 { | 1922 { |
| 1923 return isForcedFragmentainerBreakValue(breakAfter()); | 1923 return isForcedFragmentainerBreakValue(breakAfter()); |
| 1924 } | 1924 } |
| 1925 | 1925 |
| 1926 LayoutRect LayoutBox::clippedOverflowRectForPaintInvalidation(const LayoutBoxMod
elObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalid
ationState) const | 1926 LayoutRect LayoutBox::localOverflowRectForPaintInvalidation() const |
| 1927 { | 1927 { |
| 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 LayoutRect r = visualOverflowRect(); | 1935 return visualOverflowRect(); |
| 1936 mapToVisibleRectInAncestorSpace(paintInvalidationContainer, r, paintInvalida
tionState); | |
| 1937 return r; | |
| 1938 } | 1936 } |
| 1939 | 1937 |
| 1940 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 |
| 1941 { | 1939 { |
| 1942 // 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. |
| 1943 // 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 |
| 1944 // 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 |
| 1945 // 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. |
| 1946 // | 1944 // |
| 1947 // 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 |
| 1948 // 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 |
| 1949 // physical coordinate space of the paintInvalidationContainer. | 1947 // physical coordinate space of the ancestor. |
| 1950 const ComputedStyle& styleToUse = styleRef(); | 1948 const ComputedStyle& styleToUse = styleRef(); |
| 1951 | 1949 |
| 1952 EPosition position = styleToUse.position(); | 1950 EPosition position = styleToUse.position(); |
| 1953 | 1951 |
| 1954 // 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, |
| 1955 // 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 |
| 1956 // 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. |
| 1957 inflatePaintInvalidationRectForReflectionAndFilter(rect); | 1955 inflatePaintInvalidationRectForReflectionAndFilter(rect); |
| 1958 | 1956 |
| 1959 if (paintInvalidationState && paintInvalidationState->canMapToAncestor(ances
tor) && position != FixedPosition) { | |
| 1960 return paintInvalidationState->mapObjectRectToAncestor(*this, ancestor,
rect, visibleRectFlags); | |
| 1961 } | |
| 1962 | |
| 1963 if (ancestor == this) { | 1957 if (ancestor == this) { |
| 1964 if (ancestor->style()->isFlippedBlocksWritingMode()) | 1958 if (ancestor->style()->isFlippedBlocksWritingMode()) |
| 1965 flipForWritingMode(rect); | 1959 flipForWritingMode(rect); |
| 1966 return true; | 1960 return true; |
| 1967 } | 1961 } |
| 1968 | 1962 |
| 1969 bool containerSkipped; | 1963 bool containerSkipped; |
| 1970 LayoutObject* container = this->container(ancestor, &containerSkipped); | 1964 LayoutObject* container = this->container(ancestor, &containerSkipped); |
| 1971 if (!container) | 1965 if (!container) |
| 1972 return true; | 1966 return true; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2003 containerBox->mapScrollingContentsRectToBoxSpace(rect); | 1997 containerBox->mapScrollingContentsRectToBoxSpace(rect); |
| 2004 if (container != ancestor && !containerBox->applyOverflowClip(rect, visi
bleRectFlags)) | 1998 if (container != ancestor && !containerBox->applyOverflowClip(rect, visi
bleRectFlags)) |
| 2005 return false; | 1999 return false; |
| 2006 } | 2000 } |
| 2007 | 2001 |
| 2008 if (containerSkipped) { | 2002 if (containerSkipped) { |
| 2009 // 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. |
| 2010 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta
iner); | 2004 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta
iner); |
| 2011 rect.move(-containerOffset); | 2005 rect.move(-containerOffset); |
| 2012 // 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. |
| 2013 if (ancestor->style()->position() != FixedPosition && container->isLayou
tView()) | 2007 if (ancestor->style()->position() != FixedPosition && container->isLayou
tView() && position == FixedPosition) |
| 2014 toLayoutView(container)->adjustViewportConstrainedOffset(rect, Layou
tView::toViewportConstrainedPosition(position)); | 2008 toLayoutView(container)->adjustOffsetForFixedPosition(rect); |
| 2015 return true; | 2009 return true; |
| 2016 } | 2010 } |
| 2017 | 2011 |
| 2018 if (container->isLayoutView()) | 2012 if (container->isLayoutView()) |
| 2019 return toLayoutView(container)->mapToVisibleRectInAncestorSpace(ancestor
, rect, LayoutView::toViewportConstrainedPosition(position), nullptr, visibleRec
tFlags); | 2013 return toLayoutView(container)->mapToVisibleRectInAncestorSpace(ancestor
, rect, position == FixedPosition ? IsFixed : 0, visibleRectFlags); |
| 2020 else | 2014 else |
| 2021 return container->mapToVisibleRectInAncestorSpace(ancestor, rect, nullpt
r, visibleRectFlags); | 2015 return container->mapToVisibleRectInAncestorSpace(ancestor, rect, visibl
eRectFlags); |
| 2022 } | 2016 } |
| 2023 | 2017 |
| 2024 void LayoutBox::inflatePaintInvalidationRectForReflectionAndFilter(LayoutRect& p
aintInvalidationRect) const | 2018 void LayoutBox::inflatePaintInvalidationRectForReflectionAndFilter(LayoutRect& p
aintInvalidationRect) const |
| 2025 { | 2019 { |
| 2026 if (hasReflection()) | 2020 if (hasReflection()) |
| 2027 paintInvalidationRect.unite(reflectedRect(paintInvalidationRect)); | 2021 paintInvalidationRect.unite(reflectedRect(paintInvalidationRect)); |
| 2028 | 2022 |
| 2029 if (layer() && layer()->hasFilter()) | 2023 if (layer() && layer()->hasFilter()) |
| 2030 paintInvalidationRect.expand(layer()->filterOutsets()); | 2024 paintInvalidationRect.expand(layer()->filterOutsets()); |
| 2031 } | 2025 } |
| (...skipping 2411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4443 LayoutBox* boxToSplit = toLayoutBox(beforeChild->parent()); | 4437 LayoutBox* boxToSplit = toLayoutBox(beforeChild->parent()); |
| 4444 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo
us()) { | 4438 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo
us()) { |
| 4445 | 4439 |
| 4446 // We have to split the parent box into two boxes and move children | 4440 // We have to split the parent box into two boxes and move children |
| 4447 // from |beforeChild| to end into the new post box. | 4441 // from |beforeChild| to end into the new post box. |
| 4448 LayoutBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th
is); | 4442 LayoutBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th
is); |
| 4449 postBox->setChildrenInline(boxToSplit->childrenInline()); | 4443 postBox->setChildrenInline(boxToSplit->childrenInline()); |
| 4450 LayoutBox* parentBox = toLayoutBox(boxToSplit->parent()); | 4444 LayoutBox* parentBox = toLayoutBox(boxToSplit->parent()); |
| 4451 // We need to invalidate the |parentBox| before inserting the new no
de | 4445 // We need to invalidate the |parentBox| before inserting the new no
de |
| 4452 // so that the table paint invalidation logic knows the structure is
dirty. | 4446 // so that the table paint invalidation logic knows the structure is
dirty. |
| 4453 // See for example LayoutTableCell:clippedOverflowRectForPaintInvali
dation. | 4447 // See for example LayoutTableCell:localOverflowRectForPaintInvalida
tion. |
| 4454 markBoxForRelayoutAfterSplit(parentBox); | 4448 markBoxForRelayoutAfterSplit(parentBox); |
| 4455 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo
xToSplit->nextSibling()); | 4449 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo
xToSplit->nextSibling()); |
| 4456 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true); | 4450 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true); |
| 4457 | 4451 |
| 4458 LayoutObject* child = postBox->slowFirstChild(); | 4452 LayoutObject* child = postBox->slowFirstChild(); |
| 4459 ASSERT(child); | 4453 ASSERT(child); |
| 4460 if (child && !child->nextSibling()) | 4454 if (child && !child->nextSibling()) |
| 4461 collapseLoneAnonymousBlockChild(child); | 4455 collapseLoneAnonymousBlockChild(child); |
| 4462 child = boxToSplit->slowFirstChild(); | 4456 child = boxToSplit->slowFirstChild(); |
| 4463 ASSERT(child); | 4457 ASSERT(child); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4709 | 4703 |
| 4710 void LayoutBox::clearPercentHeightDescendants() | 4704 void LayoutBox::clearPercentHeightDescendants() |
| 4711 { | 4705 { |
| 4712 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde
r(this)) { | 4706 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde
r(this)) { |
| 4713 if (curr->isBox()) | 4707 if (curr->isBox()) |
| 4714 toLayoutBox(curr)->removeFromPercentHeightContainer(); | 4708 toLayoutBox(curr)->removeFromPercentHeightContainer(); |
| 4715 } | 4709 } |
| 4716 } | 4710 } |
| 4717 | 4711 |
| 4718 } // namespace blink | 4712 } // namespace blink |
| OLD | NEW |