Chromium Code Reviews| 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 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1964 layer->updateDescendantDependentFlags(); | 1964 layer->updateDescendantDependentFlags(); |
| 1965 if (layer->subtreeIsInvisible()) | 1965 if (layer->subtreeIsInvisible()) |
| 1966 return LayoutRect(); | 1966 return LayoutRect(); |
| 1967 } | 1967 } |
| 1968 | 1968 |
| 1969 return visualOverflowRect(); | 1969 return visualOverflowRect(); |
| 1970 } | 1970 } |
| 1971 | 1971 |
| 1972 bool LayoutBox::mapToVisualRectInAncestorSpace(const LayoutBoxModelObject* ances tor, LayoutRect& rect, VisualRectFlags visualRectFlags) const | 1972 bool LayoutBox::mapToVisualRectInAncestorSpace(const LayoutBoxModelObject* ances tor, LayoutRect& rect, VisualRectFlags visualRectFlags) const |
| 1973 { | 1973 { |
| 1974 // We need to inflate the paint invalidation rect before we use paintInvalid ationState, | 1974 inflateVisualRectForReflectionAndFilter(rect); |
| 1975 // else we would forget to inflate it for the current layoutObject. FIXME: I f these were | |
| 1976 // included into the visual overflow for paint invalidation, we wouldn't hav e this issue. | |
| 1977 inflatePaintInvalidationRectForReflectionAndFilter(rect); | |
| 1978 | 1975 |
| 1979 if (ancestor == this) { | 1976 if (ancestor == this) { |
| 1980 // The final rect returned is always in the physical coordinate space of the ancestor. | 1977 // The final rect returned is always in the physical coordinate space of the ancestor. |
| 1981 flipForWritingMode(rect); | 1978 flipForWritingMode(rect); |
| 1982 return true; | 1979 return true; |
| 1983 } | 1980 } |
| 1984 | 1981 |
| 1985 bool ancestorSkipped; | 1982 bool ancestorSkipped; |
| 1986 LayoutObject* container = this->container(ancestor, &ancestorSkipped); | 1983 bool filterOrReflectionSkipped; |
| 1984 LayoutObject* container = this->container(ancestor, &ancestorSkipped, &filte rOrReflectionSkipped); | |
| 1987 if (!container) | 1985 if (!container) |
| 1988 return true; | 1986 return true; |
| 1989 | 1987 |
| 1988 if (filterOrReflectionSkipped) { | |
|
chrishtr
2016/05/03 17:31:38
Please factor the contents of this if into a helpe
Xianzhu
2016/05/03 18:00:24
Done.
| |
| 1989 // Apply filter and reflection outsets between this object and container or ancestor. | |
|
jbroman
2016/05/03 17:30:48
Suggest not phrasing this as "outsets". Not all fi
Xianzhu
2016/05/03 18:00:24
Thanks for the info. Done.
| |
| 1990 LayoutSize offsetFromContainer = this->offsetFromContainer(container); | |
| 1991 rect.move(offsetFromContainer); | |
| 1992 for (LayoutObject* parent = this->parent(); parent && parent != containe r; parent = parent->parent()) { | |
| 1993 if (parent->isBox()) { | |
| 1994 // If the ancestor is below o, then we need to map the rect into ancestor's coordinates. | |
| 1995 LayoutSize parentOffset = parent->offsetFromAncestorContainer(co ntainer); | |
|
chrishtr
2016/05/03 17:31:38
This is expensive, but I suppose this whole situat
Xianzhu
2016/05/03 18:00:24
I believe it's rare because no layout test covered
| |
| 1996 rect.move(-parentOffset); | |
| 1997 toLayoutBox(parent)->inflateVisualRectForReflectionAndFilter(rec t); | |
| 1998 rect.move(parentOffset); | |
| 1999 } | |
| 2000 if (parent == ancestor) { | |
| 2001 // We meet ancestor before container. | |
| 2002 ASSERT(ancestorSkipped); | |
| 2003 break; | |
| 2004 } | |
| 2005 } | |
| 2006 rect.move(-offsetFromContainer); | |
| 2007 } | |
| 2008 | |
| 1990 // The rect we compute at each step is shifted by our x/y offset in the pare nt container's coordinate space. | 2009 // The rect we compute at each step is shifted by our x/y offset in the pare nt container's coordinate space. |
| 1991 // Only when we cross a writing mode boundary will we have to possibly flipF orWritingMode (to convert into a more | 2010 // Only when we cross a writing mode boundary will we have to possibly flipF orWritingMode (to convert into a more |
| 1992 // appropriate offset corner for the enclosing container). | 2011 // appropriate offset corner for the enclosing container). |
| 1993 if (isWritingModeRoot()) { | 2012 if (isWritingModeRoot()) { |
| 1994 flipForWritingMode(rect); | 2013 flipForWritingMode(rect); |
| 1995 // Then flip rect currently in physical direction to container's block d irection. | 2014 // Then flip rect currently in physical direction to container's block d irection. |
| 1996 if (container->styleRef().isFlippedBlocksWritingMode()) | 2015 if (container->styleRef().isFlippedBlocksWritingMode()) |
| 1997 rect.setX(m_frameRect.width() - rect.maxX()); | 2016 rect.setX(m_frameRect.width() - rect.maxX()); |
| 1998 } | 2017 } |
| 1999 | 2018 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2036 toLayoutView(container)->adjustOffsetForFixedPosition(rect); | 2055 toLayoutView(container)->adjustOffsetForFixedPosition(rect); |
| 2037 return true; | 2056 return true; |
| 2038 } | 2057 } |
| 2039 | 2058 |
| 2040 if (container->isLayoutView()) | 2059 if (container->isLayoutView()) |
| 2041 return toLayoutView(container)->mapToVisualRectInAncestorSpace(ancestor, rect, position == FixedPosition ? IsFixed : 0, visualRectFlags); | 2060 return toLayoutView(container)->mapToVisualRectInAncestorSpace(ancestor, rect, position == FixedPosition ? IsFixed : 0, visualRectFlags); |
| 2042 else | 2061 else |
| 2043 return container->mapToVisualRectInAncestorSpace(ancestor, rect, visualR ectFlags); | 2062 return container->mapToVisualRectInAncestorSpace(ancestor, rect, visualR ectFlags); |
| 2044 } | 2063 } |
| 2045 | 2064 |
| 2046 void LayoutBox::inflatePaintInvalidationRectForReflectionAndFilter(LayoutRect& p aintInvalidationRect) const | 2065 void LayoutBox::inflateVisualRectForReflectionAndFilter(LayoutRect& paintInvalid ationRect) const |
| 2047 { | 2066 { |
| 2048 if (!RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && hasReflection() ) | 2067 if (!RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && hasReflection() ) |
| 2049 paintInvalidationRect.unite(reflectedRect(paintInvalidationRect)); | 2068 paintInvalidationRect.unite(reflectedRect(paintInvalidationRect)); |
| 2050 | 2069 |
| 2051 if (layer() && layer()->hasFilterInducingProperty()) | 2070 if (layer() && layer()->hasFilterInducingProperty()) |
| 2052 paintInvalidationRect = layer()->mapLayoutRectForFilter(paintInvalidatio nRect); | 2071 paintInvalidationRect = layer()->mapLayoutRectForFilter(paintInvalidatio nRect); |
| 2053 } | 2072 } |
| 2054 | 2073 |
| 2055 void LayoutBox::invalidatePaintForOverhangingFloats(bool) | 2074 void LayoutBox::invalidatePaintForOverhangingFloats(bool) |
| 2056 { | 2075 { |
| (...skipping 2694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4751 | 4770 |
| 4752 void LayoutBox::clearPercentHeightDescendants() | 4771 void LayoutBox::clearPercentHeightDescendants() |
| 4753 { | 4772 { |
| 4754 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { | 4773 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { |
| 4755 if (curr->isBox()) | 4774 if (curr->isBox()) |
| 4756 toLayoutBox(curr)->removeFromPercentHeightContainer(); | 4775 toLayoutBox(curr)->removeFromPercentHeightContainer(); |
| 4757 } | 4776 } |
| 4758 } | 4777 } |
| 4759 | 4778 |
| 4760 } // namespace blink | 4779 } // namespace blink |
| OLD | NEW |