Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| index 70e2509cb39ec661154035ac38b7e44ec691b6e9..a2256666220b04b9be9da6734fa2eeff32a36d6b 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| @@ -1971,10 +1971,7 @@ LayoutRect LayoutBox::localOverflowRectForPaintInvalidation() const |
| bool LayoutBox::mapToVisualRectInAncestorSpace(const LayoutBoxModelObject* ancestor, LayoutRect& rect, VisualRectFlags visualRectFlags) const |
| { |
| - // We need to inflate the paint invalidation rect before we use paintInvalidationState, |
| - // else we would forget to inflate it for the current layoutObject. FIXME: If these were |
| - // included into the visual overflow for paint invalidation, we wouldn't have this issue. |
| - inflatePaintInvalidationRectForReflectionAndFilter(rect); |
| + inflateVisualRectForReflectionAndFilter(rect); |
| if (ancestor == this) { |
| // The final rect returned is always in the physical coordinate space of the ancestor. |
| @@ -1983,10 +1980,32 @@ bool LayoutBox::mapToVisualRectInAncestorSpace(const LayoutBoxModelObject* ances |
| } |
| bool ancestorSkipped; |
| - LayoutObject* container = this->container(ancestor, &ancestorSkipped); |
| + bool filterOrReflectionSkipped; |
| + LayoutObject* container = this->container(ancestor, &ancestorSkipped, &filterOrReflectionSkipped); |
| if (!container) |
| return true; |
| + 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.
|
| + // 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.
|
| + LayoutSize offsetFromContainer = this->offsetFromContainer(container); |
| + rect.move(offsetFromContainer); |
| + for (LayoutObject* parent = this->parent(); parent && parent != container; parent = parent->parent()) { |
| + if (parent->isBox()) { |
| + // If the ancestor is below o, then we need to map the rect into ancestor's coordinates. |
| + LayoutSize parentOffset = parent->offsetFromAncestorContainer(container); |
|
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
|
| + rect.move(-parentOffset); |
| + toLayoutBox(parent)->inflateVisualRectForReflectionAndFilter(rect); |
| + rect.move(parentOffset); |
| + } |
| + if (parent == ancestor) { |
| + // We meet ancestor before container. |
| + ASSERT(ancestorSkipped); |
| + break; |
| + } |
| + } |
| + rect.move(-offsetFromContainer); |
| + } |
| + |
| // The rect we compute at each step is shifted by our x/y offset in the parent container's coordinate space. |
| // Only when we cross a writing mode boundary will we have to possibly flipForWritingMode (to convert into a more |
| // appropriate offset corner for the enclosing container). |
| @@ -2043,7 +2062,7 @@ bool LayoutBox::mapToVisualRectInAncestorSpace(const LayoutBoxModelObject* ances |
| return container->mapToVisualRectInAncestorSpace(ancestor, rect, visualRectFlags); |
| } |
| -void LayoutBox::inflatePaintInvalidationRectForReflectionAndFilter(LayoutRect& paintInvalidationRect) const |
| +void LayoutBox::inflateVisualRectForReflectionAndFilter(LayoutRect& paintInvalidationRect) const |
| { |
| if (!RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && hasReflection()) |
| paintInvalidationRect.unite(reflectedRect(paintInvalidationRect)); |