| 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 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 } | 1467 } |
| 1468 return false; | 1468 return false; |
| 1469 } | 1469 } |
| 1470 | 1470 |
| 1471 bool LayoutBox::intersectsVisibleViewport() | 1471 bool LayoutBox::intersectsVisibleViewport() |
| 1472 { | 1472 { |
| 1473 LayoutRect rect = visualOverflowRect(); | 1473 LayoutRect rect = visualOverflowRect(); |
| 1474 LayoutView* layoutView = view(); | 1474 LayoutView* layoutView = view(); |
| 1475 while (layoutView->frame()->ownerLayoutObject()) | 1475 while (layoutView->frame()->ownerLayoutObject()) |
| 1476 layoutView = layoutView->frame()->ownerLayoutObject()->view(); | 1476 layoutView = layoutView->frame()->ownerLayoutObject()->view(); |
| 1477 mapToVisibleRectInAncestorSpace(layoutView, rect, nullptr); | 1477 mapToVisibleRectInAncestorSpace(layoutView, rect); |
| 1478 return rect.intersects(LayoutRect(layoutView->frameView()->getScrollableArea
()->visibleContentRectDouble())); | 1478 return rect.intersects(LayoutRect(layoutView->frameView()->getScrollableArea
()->visibleContentRectDouble())); |
| 1479 } | 1479 } |
| 1480 | 1480 |
| 1481 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(const PaintInvalidati
onState& paintInvalidationState) | 1481 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(const PaintInvalidati
onState& paintInvalidationState) |
| 1482 { | 1482 { |
| 1483 if (isFloating()) | 1483 if (isFloating()) |
| 1484 paintInvalidationState.enclosingSelfPaintingLayer(*this).setNeedsPaintPh
aseFloat(); | 1484 paintInvalidationState.enclosingSelfPaintingLayer(*this).setNeedsPaintPh
aseFloat(); |
| 1485 | 1485 |
| 1486 if (hasBoxDecorationBackground() | 1486 if (hasBoxDecorationBackground() |
| 1487 // We also paint overflow controls in background phase. | 1487 // We also paint overflow controls in background phase. |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1668 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); | 1668 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); |
| 1669 if (fillAvailableExtent == -1) | 1669 if (fillAvailableExtent == -1) |
| 1670 return fillFallbackExtent; | 1670 return fillFallbackExtent; |
| 1671 return std::min(fillAvailableExtent, fillFallbackExtent); | 1671 return std::min(fillAvailableExtent, fillFallbackExtent); |
| 1672 } | 1672 } |
| 1673 | 1673 |
| 1674 // Use the content box logical height as specified by the style. | 1674 // Use the content box logical height as specified by the style. |
| 1675 return cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(logicalHeigh
tLength.value())); | 1675 return cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(logicalHeigh
tLength.value())); |
| 1676 } | 1676 } |
| 1677 | 1677 |
| 1678 void LayoutBox::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transfo
rmState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const PaintIn
validationState* paintInvalidationState) const | 1678 void LayoutBox::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transfo
rmState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const |
| 1679 { | 1679 { |
| 1680 bool isFixedPos = style()->position() == FixedPosition; | 1680 bool isFixedPos = style()->position() == FixedPosition; |
| 1681 bool hasTransform = hasLayer() && layer()->transform(); | 1681 bool hasTransform = hasLayer() && layer()->transform(); |
| 1682 // If this box has a transform, it acts as a fixed position container for fi
xed descendants, | 1682 // If this box has a transform, it acts as a fixed position container for fi
xed descendants, |
| 1683 // and may itself also be fixed position. So propagate 'fixed' up only if th
is box is fixed position. | 1683 // and may itself also be fixed position. So propagate 'fixed' up only if th
is box is fixed position. |
| 1684 if (hasTransform && !isFixedPos) | 1684 if (hasTransform && !isFixedPos) |
| 1685 mode &= ~IsFixed; | 1685 mode &= ~IsFixed; |
| 1686 else if (isFixedPos) | 1686 else if (isFixedPos) |
| 1687 mode |= IsFixed; | 1687 mode |= IsFixed; |
| 1688 | 1688 |
| 1689 LayoutBoxModelObject::mapLocalToAncestor(ancestor, transformState, mode, was
Fixed, paintInvalidationState); | 1689 LayoutBoxModelObject::mapLocalToAncestor(ancestor, transformState, mode, was
Fixed); |
| 1690 } | 1690 } |
| 1691 | 1691 |
| 1692 void LayoutBox::mapAncestorToLocal(const LayoutBoxModelObject* ancestor, Transfo
rmState& transformState, MapCoordinatesFlags mode) const | 1692 void LayoutBox::mapAncestorToLocal(const LayoutBoxModelObject* ancestor, Transfo
rmState& transformState, MapCoordinatesFlags mode) const |
| 1693 { | 1693 { |
| 1694 if (this == ancestor) | 1694 if (this == ancestor) |
| 1695 return; | 1695 return; |
| 1696 | 1696 |
| 1697 bool isFixedPos = style()->position() == FixedPosition; | 1697 bool isFixedPos = style()->position() == FixedPosition; |
| 1698 bool hasTransform = hasLayer() && layer()->transform(); | 1698 bool hasTransform = hasLayer() && layer()->transform(); |
| 1699 if (hasTransform && !isFixedPos) { | 1699 if (hasTransform && !isFixedPos) { |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 bool LayoutBox::hasForcedBreakBefore() const | 1908 bool LayoutBox::hasForcedBreakBefore() const |
| 1909 { | 1909 { |
| 1910 return isForcedFragmentainerBreakValue(breakBefore()); | 1910 return isForcedFragmentainerBreakValue(breakBefore()); |
| 1911 } | 1911 } |
| 1912 | 1912 |
| 1913 bool LayoutBox::hasForcedBreakAfter() const | 1913 bool LayoutBox::hasForcedBreakAfter() const |
| 1914 { | 1914 { |
| 1915 return isForcedFragmentainerBreakValue(breakAfter()); | 1915 return isForcedFragmentainerBreakValue(breakAfter()); |
| 1916 } | 1916 } |
| 1917 | 1917 |
| 1918 LayoutRect LayoutBox::clippedOverflowRectForPaintInvalidation(const LayoutBoxMod
elObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalid
ationState) const | 1918 LayoutRect LayoutBox::localOverflowRectForPaintInvalidation() const |
| 1919 { | 1919 { |
| 1920 if (style()->visibility() != VISIBLE) { | 1920 if (style()->visibility() != VISIBLE) { |
| 1921 PaintLayer* layer = enclosingLayer(); | 1921 PaintLayer* layer = enclosingLayer(); |
| 1922 layer->updateDescendantDependentFlags(); | 1922 layer->updateDescendantDependentFlags(); |
| 1923 if (layer->subtreeIsInvisible()) | 1923 if (layer->subtreeIsInvisible()) |
| 1924 return LayoutRect(); | 1924 return LayoutRect(); |
| 1925 } | 1925 } |
| 1926 | 1926 |
| 1927 LayoutRect r = visualOverflowRect(); | 1927 return visualOverflowRect(); |
| 1928 mapToVisibleRectInAncestorSpace(paintInvalidationContainer, r, paintInvalida
tionState); | |
| 1929 return r; | |
| 1930 } | 1928 } |
| 1931 | 1929 |
| 1932 void LayoutBox::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ance
stor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState) co
nst | 1930 void LayoutBox::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ance
stor, LayoutRect& rect) const |
| 1933 { | 1931 { |
| 1934 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. | 1932 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. |
| 1935 // Only when we cross a writing mode boundary will we have to possibly flipF
orWritingMode (to convert into a more appropriate | 1933 // Only when we cross a writing mode boundary will we have to possibly flipF
orWritingMode (to convert into a more appropriate |
| 1936 // offset corner for the enclosing container). This allows for a fully RL or
BT document to issue paint invalidations | 1934 // offset corner for the enclosing container). This allows for a fully RL or
BT document to issue paint invalidations |
| 1937 // properly even during layout, since the rect remains flipped all the way u
ntil the end. | 1935 // properly even during layout, since the rect remains flipped all the way u
ntil the end. |
| 1938 // | 1936 // |
| 1939 // LayoutView::computeRectForPaintInvalidation then converts the rect to phy
sical coordinates. We also convert to | 1937 // LayoutView::computeRectForPaintInvalidation then converts the rect to phy
sical coordinates. We also convert to |
| 1940 // physical when we hit a paintInvalidationContainer boundary. Therefore the
final rect returned is always in the | 1938 // physical when we hit the ancestor. Therefore the final rect returned is a
lways in the |
| 1941 // physical coordinate space of the paintInvalidationContainer. | 1939 // physical coordinate space of the ancestor. |
| 1942 const ComputedStyle& styleToUse = styleRef(); | 1940 const ComputedStyle& styleToUse = styleRef(); |
| 1943 | 1941 |
| 1944 EPosition position = styleToUse.position(); | 1942 EPosition position = styleToUse.position(); |
| 1945 | 1943 |
| 1946 // We need to inflate the paint invalidation rect before we use paintInvalid
ationState, | 1944 // We need to inflate the paint invalidation rect before we use paintInvalid
ationState, |
| 1947 // else we would forget to inflate it for the current layoutObject. FIXME: I
f these were | 1945 // else we would forget to inflate it for the current layoutObject. FIXME: I
f these were |
| 1948 // included into the visual overflow for repaint, we wouldn't have this issu
e. | 1946 // included into the visual overflow for paint invalidation, we wouldn't hav
e this issue. |
| 1949 inflatePaintInvalidationRectForReflectionAndFilter(rect); | 1947 inflatePaintInvalidationRectForReflectionAndFilter(rect); |
| 1950 | 1948 |
| 1951 if (paintInvalidationState && paintInvalidationState->canMapToAncestor(ances
tor) && position != FixedPosition) { | |
| 1952 paintInvalidationState->mapObjectRectToAncestor(*this, ancestor, rect); | |
| 1953 return; | |
| 1954 } | |
| 1955 | |
| 1956 if (ancestor == this) { | 1949 if (ancestor == this) { |
| 1957 if (ancestor->style()->isFlippedBlocksWritingMode()) | 1950 if (ancestor->style()->isFlippedBlocksWritingMode()) |
| 1958 flipForWritingMode(rect); | 1951 flipForWritingMode(rect); |
| 1959 return; | 1952 return; |
| 1960 } | 1953 } |
| 1961 | 1954 |
| 1962 bool containerSkipped; | 1955 bool containerSkipped; |
| 1963 LayoutObject* container = this->container(ancestor, &containerSkipped); | 1956 LayoutObject* container = this->container(ancestor, &containerSkipped); |
| 1964 if (!container) | 1957 if (!container) |
| 1965 return; | 1958 return; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2004 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. | 1997 // If the paintInvalidationContainer is below o, then we need to map the
rect into paintInvalidationContainer's coordinates. |
| 2005 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta
iner); | 1998 LayoutSize containerOffset = ancestor->offsetFromAncestorContainer(conta
iner); |
| 2006 rect.move(-containerOffset); | 1999 rect.move(-containerOffset); |
| 2007 // If the paintInvalidationContainer is fixed, then the rect is already
in its coordinates so doesn't need viewport-adjusting. | 2000 // If the paintInvalidationContainer is fixed, then the rect is already
in its coordinates so doesn't need viewport-adjusting. |
| 2008 if (ancestor->style()->position() != FixedPosition && container->isLayou
tView()) | 2001 if (ancestor->style()->position() != FixedPosition && container->isLayou
tView()) |
| 2009 toLayoutView(container)->adjustViewportConstrainedOffset(rect, Layou
tView::toViewportConstrainedPosition(position)); | 2002 toLayoutView(container)->adjustViewportConstrainedOffset(rect, Layou
tView::toViewportConstrainedPosition(position)); |
| 2010 return; | 2003 return; |
| 2011 } | 2004 } |
| 2012 | 2005 |
| 2013 if (container->isLayoutView()) | 2006 if (container->isLayoutView()) |
| 2014 toLayoutView(container)->mapToVisibleRectInAncestorSpace(ancestor, rect,
LayoutView::toViewportConstrainedPosition(position), nullptr); | 2007 toLayoutView(container)->mapToVisibleRectInAncestorSpace(ancestor, rect,
LayoutView::toViewportConstrainedPosition(position)); |
| 2015 else | 2008 else |
| 2016 container->mapToVisibleRectInAncestorSpace(ancestor, rect, nullptr); | 2009 container->mapToVisibleRectInAncestorSpace(ancestor, rect); |
| 2017 } | 2010 } |
| 2018 | 2011 |
| 2019 void LayoutBox::inflatePaintInvalidationRectForReflectionAndFilter(LayoutRect& p
aintInvalidationRect) const | 2012 void LayoutBox::inflatePaintInvalidationRectForReflectionAndFilter(LayoutRect& p
aintInvalidationRect) const |
| 2020 { | 2013 { |
| 2021 if (hasReflection()) | 2014 if (hasReflection()) |
| 2022 paintInvalidationRect.unite(reflectedRect(paintInvalidationRect)); | 2015 paintInvalidationRect.unite(reflectedRect(paintInvalidationRect)); |
| 2023 | 2016 |
| 2024 if (layer() && layer()->hasFilter()) | 2017 if (layer() && layer()->hasFilter()) |
| 2025 paintInvalidationRect.expand(layer()->filterOutsets()); | 2018 paintInvalidationRect.expand(layer()->filterOutsets()); |
| 2026 } | 2019 } |
| (...skipping 2411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4438 LayoutBox* boxToSplit = toLayoutBox(beforeChild->parent()); | 4431 LayoutBox* boxToSplit = toLayoutBox(beforeChild->parent()); |
| 4439 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo
us()) { | 4432 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo
us()) { |
| 4440 | 4433 |
| 4441 // We have to split the parent box into two boxes and move children | 4434 // We have to split the parent box into two boxes and move children |
| 4442 // from |beforeChild| to end into the new post box. | 4435 // from |beforeChild| to end into the new post box. |
| 4443 LayoutBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th
is); | 4436 LayoutBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th
is); |
| 4444 postBox->setChildrenInline(boxToSplit->childrenInline()); | 4437 postBox->setChildrenInline(boxToSplit->childrenInline()); |
| 4445 LayoutBox* parentBox = toLayoutBox(boxToSplit->parent()); | 4438 LayoutBox* parentBox = toLayoutBox(boxToSplit->parent()); |
| 4446 // We need to invalidate the |parentBox| before inserting the new no
de | 4439 // We need to invalidate the |parentBox| before inserting the new no
de |
| 4447 // so that the table paint invalidation logic knows the structure is
dirty. | 4440 // so that the table paint invalidation logic knows the structure is
dirty. |
| 4448 // See for example LayoutTableCell:clippedOverflowRectForPaintInvali
dation. | 4441 // See for example LayoutTableCell:localOverflowRectForPaintInvalida
tion. |
| 4449 markBoxForRelayoutAfterSplit(parentBox); | 4442 markBoxForRelayoutAfterSplit(parentBox); |
| 4450 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo
xToSplit->nextSibling()); | 4443 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo
xToSplit->nextSibling()); |
| 4451 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true); | 4444 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true); |
| 4452 | 4445 |
| 4453 LayoutObject* child = postBox->slowFirstChild(); | 4446 LayoutObject* child = postBox->slowFirstChild(); |
| 4454 ASSERT(child); | 4447 ASSERT(child); |
| 4455 if (child && !child->nextSibling()) | 4448 if (child && !child->nextSibling()) |
| 4456 collapseLoneAnonymousBlockChild(child); | 4449 collapseLoneAnonymousBlockChild(child); |
| 4457 child = boxToSplit->slowFirstChild(); | 4450 child = boxToSplit->slowFirstChild(); |
| 4458 ASSERT(child); | 4451 ASSERT(child); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4704 | 4697 |
| 4705 void LayoutBox::clearPercentHeightDescendants() | 4698 void LayoutBox::clearPercentHeightDescendants() |
| 4706 { | 4699 { |
| 4707 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde
r(this)) { | 4700 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde
r(this)) { |
| 4708 if (curr->isBox()) | 4701 if (curr->isBox()) |
| 4709 toLayoutBox(curr)->removeFromPercentHeightContainer(); | 4702 toLayoutBox(curr)->removeFromPercentHeightContainer(); |
| 4710 } | 4703 } |
| 4711 } | 4704 } |
| 4712 | 4705 |
| 4713 } // namespace blink | 4706 } // namespace blink |
| OLD | NEW |