Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 1934833002: Ensure filter and reflection outsets are applied on paint invalidation rect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 if (style()->visibility() != VISIBLE) { 1962 if (style()->visibility() != VISIBLE) {
1963 PaintLayer* layer = enclosingLayer(); 1963 PaintLayer* layer = enclosingLayer();
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 void LayoutBox::inflateVisualRectForReflectionAndFilterUnderContainer(LayoutRect & rect, const LayoutObject& container, const LayoutBoxModelObject* ancestorToSto pAt) const
1973 {
1974 // Apply visual overflow caused by reflections and filters defined on object s between this object
1975 // and container (not included) or ancestorToStopAt (included).
1976 LayoutSize offsetFromContainer = this->offsetFromContainer(&container);
1977 rect.move(offsetFromContainer);
1978 for (LayoutObject* parent = this->parent(); parent && parent != container; p arent = parent->parent()) {
1979 if (parent->isBox()) {
1980 // Convert rect into coordinate space of parent to apply parent's re flection and filter.
1981 LayoutSize parentOffset = parent->offsetFromAncestorContainer(&conta iner);
1982 rect.move(-parentOffset);
1983 toLayoutBox(parent)->inflateVisualRectForReflectionAndFilter(rect);
1984 rect.move(parentOffset);
1985 }
1986 if (parent == ancestorToStopAt)
1987 break;
1988 }
1989 rect.move(-offsetFromContainer);
1990 }
1991
1972 bool LayoutBox::mapToVisualRectInAncestorSpace(const LayoutBoxModelObject* ances tor, LayoutRect& rect, VisualRectFlags visualRectFlags) const 1992 bool LayoutBox::mapToVisualRectInAncestorSpace(const LayoutBoxModelObject* ances tor, LayoutRect& rect, VisualRectFlags visualRectFlags) const
1973 { 1993 {
1974 // We need to inflate the paint invalidation rect before we use paintInvalid ationState, 1994 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 1995
1979 if (ancestor == this) { 1996 if (ancestor == this) {
1980 // The final rect returned is always in the physical coordinate space of the ancestor. 1997 // The final rect returned is always in the physical coordinate space of the ancestor.
1981 flipForWritingMode(rect); 1998 flipForWritingMode(rect);
1982 return true; 1999 return true;
1983 } 2000 }
1984 2001
1985 bool ancestorSkipped; 2002 bool ancestorSkipped;
1986 LayoutObject* container = this->container(ancestor, &ancestorSkipped); 2003 bool filterOrReflectionSkipped;
2004 LayoutObject* container = this->container(ancestor, &ancestorSkipped, &filte rOrReflectionSkipped);
1987 if (!container) 2005 if (!container)
1988 return true; 2006 return true;
1989 2007
2008 if (filterOrReflectionSkipped)
2009 inflateVisualRectForReflectionAndFilterUnderContainer(rect, *container, ancestor);
2010
1990 // The rect we compute at each step is shifted by our x/y offset in the pare nt container's coordinate space. 2011 // 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 2012 // 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). 2013 // appropriate offset corner for the enclosing container).
1993 if (isWritingModeRoot()) { 2014 if (isWritingModeRoot()) {
1994 flipForWritingMode(rect); 2015 flipForWritingMode(rect);
1995 // Then flip rect currently in physical direction to container's block d irection. 2016 // Then flip rect currently in physical direction to container's block d irection.
1996 if (container->styleRef().isFlippedBlocksWritingMode()) 2017 if (container->styleRef().isFlippedBlocksWritingMode())
1997 rect.setX(m_frameRect.width() - rect.maxX()); 2018 rect.setX(m_frameRect.width() - rect.maxX());
1998 } 2019 }
1999 2020
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2036 toLayoutView(container)->adjustOffsetForFixedPosition(rect); 2057 toLayoutView(container)->adjustOffsetForFixedPosition(rect);
2037 return true; 2058 return true;
2038 } 2059 }
2039 2060
2040 if (container->isLayoutView()) 2061 if (container->isLayoutView())
2041 return toLayoutView(container)->mapToVisualRectInAncestorSpace(ancestor, rect, position == FixedPosition ? IsFixed : 0, visualRectFlags); 2062 return toLayoutView(container)->mapToVisualRectInAncestorSpace(ancestor, rect, position == FixedPosition ? IsFixed : 0, visualRectFlags);
2042 else 2063 else
2043 return container->mapToVisualRectInAncestorSpace(ancestor, rect, visualR ectFlags); 2064 return container->mapToVisualRectInAncestorSpace(ancestor, rect, visualR ectFlags);
2044 } 2065 }
2045 2066
2046 void LayoutBox::inflatePaintInvalidationRectForReflectionAndFilter(LayoutRect& p aintInvalidationRect) const 2067 void LayoutBox::inflateVisualRectForReflectionAndFilter(LayoutRect& paintInvalid ationRect) const
2047 { 2068 {
2048 if (!RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && hasReflection() ) 2069 if (!RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && hasReflection() )
2049 paintInvalidationRect.unite(reflectedRect(paintInvalidationRect)); 2070 paintInvalidationRect.unite(reflectedRect(paintInvalidationRect));
2050 2071
2051 if (layer() && layer()->hasFilterInducingProperty()) 2072 if (layer() && layer()->hasFilterInducingProperty())
2052 paintInvalidationRect = layer()->mapLayoutRectForFilter(paintInvalidatio nRect); 2073 paintInvalidationRect = layer()->mapLayoutRectForFilter(paintInvalidatio nRect);
2053 } 2074 }
2054 2075
2055 void LayoutBox::invalidatePaintForOverhangingFloats(bool) 2076 void LayoutBox::invalidatePaintForOverhangingFloats(bool)
2056 { 2077 {
(...skipping 2694 matching lines...) Expand 10 before | Expand all | Expand 10 after
4751 4772
4752 void LayoutBox::clearPercentHeightDescendants() 4773 void LayoutBox::clearPercentHeightDescendants()
4753 { 4774 {
4754 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { 4775 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) {
4755 if (curr->isBox()) 4776 if (curr->isBox())
4756 toLayoutBox(curr)->removeFromPercentHeightContainer(); 4777 toLayoutBox(curr)->removeFromPercentHeightContainer();
4757 } 4778 }
4758 } 4779 }
4759 4780
4760 } // namespace blink 4781 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698