haikuwebkit/Source/WebCore/rendering/LayerOverlapMap.h

74 lines
2.6 KiB
C
Raw Permalink Normal View History

Move RenderLayerCompositor's OverlapMap to its own file https://bugs.webkit.org/show_bug.cgi?id=197915 Reviewed by Alex Christensen. Move OverlapMap to its own file. Make use of RectList, which was in the file but unused! Allocate OverlapMapContainer on the heap both to avoid header pollution of internals, and because they will get bigger in future. No behavior change. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/LayerOverlapMap.cpp: Added. (WebCore::RectList::append): (WebCore::RectList::intersects const): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::unite): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): * rendering/LayerOverlapMap.h: Added. (WebCore::LayerOverlapMap::isEmpty const): (WebCore::LayerOverlapMap::geometryMap const): (WebCore::LayerOverlapMap::geometryMap): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::RenderLayerCompositor::addToOverlapMap): (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): (WebCore::OverlapMapContainer::add): Deleted. (WebCore::OverlapMapContainer::overlapsLayers const): Deleted. (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::OverlapMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::add): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::overlapsLayers const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::isEmpty const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::pushCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::popCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::append): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::intersects const): Deleted. * rendering/RenderLayerCompositor.h: Canonical link: https://commits.webkit.org/212039@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-15 15:59:21 +00:00
/*
* Copyright (C) 2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include "LayoutRect.h"
#include "RenderGeometryMap.h"
namespace WTF {
class TextStream;
}
Move RenderLayerCompositor's OverlapMap to its own file https://bugs.webkit.org/show_bug.cgi?id=197915 Reviewed by Alex Christensen. Move OverlapMap to its own file. Make use of RectList, which was in the file but unused! Allocate OverlapMapContainer on the heap both to avoid header pollution of internals, and because they will get bigger in future. No behavior change. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/LayerOverlapMap.cpp: Added. (WebCore::RectList::append): (WebCore::RectList::intersects const): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::unite): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): * rendering/LayerOverlapMap.h: Added. (WebCore::LayerOverlapMap::isEmpty const): (WebCore::LayerOverlapMap::geometryMap const): (WebCore::LayerOverlapMap::geometryMap): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::RenderLayerCompositor::addToOverlapMap): (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): (WebCore::OverlapMapContainer::add): Deleted. (WebCore::OverlapMapContainer::overlapsLayers const): Deleted. (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::OverlapMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::add): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::overlapsLayers const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::isEmpty const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::pushCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::popCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::append): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::intersects const): Deleted. * rendering/RenderLayerCompositor.h: Canonical link: https://commits.webkit.org/212039@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-15 15:59:21 +00:00
namespace WebCore {
Layer flashing and poor perf during scrolling of message list on gmail.com and hotmail.com - overlap testing needs to constrained to clipping scopes https://bugs.webkit.org/show_bug.cgi?id=198091 <rdar://problem/49403082> Reviewed by Antti Koivisto. Source/WebCore: When overflow:scroll is scrolled asynchronously, we need to have already created compositing layers where necessary for clipped-out layers in the scrolled content so that we have something to reveal. We also have ensure that layers inside the scroller (but scrolled out of view) don't trigger overlap with layers outside the scroller. All this has to work when the containing block hierarchy (clipping/scrolling) doesn't match the paint order hierarchy (structure of the z-order and compositing trees). Overlap testing previously simply used a list of rectangles per compositing container (OverlapMapContainer). This is a series of layer bounds, built up as we traver the layer tree in z-order. Layers contribute to container N-2, and test against container N-1. To handle overlap with non-stacking-context scrollers, introduce the concept of a ClippingScope, which encompasses a set of layers sharing the same composited-scrolling containing-block ancestor. Within a ClippingScope, layer bounds are computed unclipped. Between them, bounds are tested clipped. Conceptually, each OverlapMapContainer has a tree of ClippingScopes (reflecting the containing-block order tree of composited overflow scroll), and rects are added to the appropriate ClippingScope. This tree is currently always root-relative; the root node is the RenderView's RenderLayer, and will accumulate the bounds of layers not inside composited overflow scroll (just like the old code). When a OverlapMapContainer is popped, the list of rectangles in its ClippingScope tree is merged with that of the previous container. Tests: compositing/layer-creation/clipping-scope/nested-scroller-overlap.html compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller.html compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller.html compositing/layer-creation/clipping-scope/scroller-with-negative-z-children.html compositing/layer-creation/clipping-scope/shared-layers-in-scroller.html * rendering/LayerOverlapMap.cpp: (WebCore::operator<<): (WebCore::OverlapMapContainer::OverlapMapContainer): (WebCore::OverlapMapContainer::ClippingScope::ClippingScope): (WebCore::OverlapMapContainer::ClippingScope::childWithLayer const): (WebCore::OverlapMapContainer::ClippingScope::addChildWithLayerAndBounds): (WebCore::OverlapMapContainer::ClippingScope::addChild): (WebCore::OverlapMapContainer::ClippingScope::appendRect): (WebCore::OverlapMapContainer::clippingScopeContainingLayerChildRecursive): (WebCore::OverlapMapContainer::scopeContainingLayer const): (WebCore::OverlapMapContainer::rootScope const): (WebCore::OverlapMapContainer::rootScope): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::mergeClippingScopesRecursive): (WebCore::OverlapMapContainer::append): (WebCore::OverlapMapContainer::ensureClippingScopeForLayers): (WebCore::OverlapMapContainer::findClippingScopeForLayers const): (WebCore::OverlapMapContainer::recursiveOutputToStream const): (WebCore::OverlapMapContainer::dump const): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::OverlapMapContainer::rectList const): Deleted. * rendering/LayerOverlapMap.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::BackingSharingState::appendSharingLayer): (WebCore::RenderLayerCompositor::BackingSharingState::updateBeforeDescendantTraversal): (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::createsClippingScope): (WebCore::enclosingClippingScopes): (WebCore::RenderLayerCompositor::addToOverlapMap const): (WebCore::RenderLayerCompositor::updateOverlapMap const): (WebCore::RenderLayerCompositor::layerOverlaps const): * rendering/RenderLayerCompositor.h: Source/WebCore/../../LayoutTests: * TestExpectations: * compositing/layer-creation/clipping-scope/nested-scroller-overlap-expected.txt: Added. * compositing/layer-creation/clipping-scope/nested-scroller-overlap.html: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller.html: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller.html: Added. * compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt: Added. * compositing/layer-creation/clipping-scope/scroller-with-negative-z-children.html: Added. * compositing/layer-creation/clipping-scope/shared-layers-in-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/shared-layers-in-scroller.html: Added. * platform/ios-wk2/TestExpectations: * platform/ios-wk2/compositing/layer-creation/clipping-scope/nested-scroller-overlap-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/shared-layers-in-scroller-expected.txt: Added. * platform/mac-wk2/TestExpectations: Canonical link: https://commits.webkit.org/212178@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245602 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-22 00:12:49 +00:00
class OverflowAwareOverlapContainer;
Move RenderLayerCompositor's OverlapMap to its own file https://bugs.webkit.org/show_bug.cgi?id=197915 Reviewed by Alex Christensen. Move OverlapMap to its own file. Make use of RectList, which was in the file but unused! Allocate OverlapMapContainer on the heap both to avoid header pollution of internals, and because they will get bigger in future. No behavior change. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/LayerOverlapMap.cpp: Added. (WebCore::RectList::append): (WebCore::RectList::intersects const): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::unite): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): * rendering/LayerOverlapMap.h: Added. (WebCore::LayerOverlapMap::isEmpty const): (WebCore::LayerOverlapMap::geometryMap const): (WebCore::LayerOverlapMap::geometryMap): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::RenderLayerCompositor::addToOverlapMap): (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): (WebCore::OverlapMapContainer::add): Deleted. (WebCore::OverlapMapContainer::overlapsLayers const): Deleted. (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::OverlapMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::add): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::overlapsLayers const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::isEmpty const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::pushCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::popCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::append): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::intersects const): Deleted. * rendering/RenderLayerCompositor.h: Canonical link: https://commits.webkit.org/212039@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-15 15:59:21 +00:00
class OverlapMapContainer;
Layer flashing and poor perf during scrolling of message list on gmail.com and hotmail.com - overlap testing needs to constrained to clipping scopes https://bugs.webkit.org/show_bug.cgi?id=198091 <rdar://problem/49403082> Reviewed by Antti Koivisto. Source/WebCore: When overflow:scroll is scrolled asynchronously, we need to have already created compositing layers where necessary for clipped-out layers in the scrolled content so that we have something to reveal. We also have ensure that layers inside the scroller (but scrolled out of view) don't trigger overlap with layers outside the scroller. All this has to work when the containing block hierarchy (clipping/scrolling) doesn't match the paint order hierarchy (structure of the z-order and compositing trees). Overlap testing previously simply used a list of rectangles per compositing container (OverlapMapContainer). This is a series of layer bounds, built up as we traver the layer tree in z-order. Layers contribute to container N-2, and test against container N-1. To handle overlap with non-stacking-context scrollers, introduce the concept of a ClippingScope, which encompasses a set of layers sharing the same composited-scrolling containing-block ancestor. Within a ClippingScope, layer bounds are computed unclipped. Between them, bounds are tested clipped. Conceptually, each OverlapMapContainer has a tree of ClippingScopes (reflecting the containing-block order tree of composited overflow scroll), and rects are added to the appropriate ClippingScope. This tree is currently always root-relative; the root node is the RenderView's RenderLayer, and will accumulate the bounds of layers not inside composited overflow scroll (just like the old code). When a OverlapMapContainer is popped, the list of rectangles in its ClippingScope tree is merged with that of the previous container. Tests: compositing/layer-creation/clipping-scope/nested-scroller-overlap.html compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller.html compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller.html compositing/layer-creation/clipping-scope/scroller-with-negative-z-children.html compositing/layer-creation/clipping-scope/shared-layers-in-scroller.html * rendering/LayerOverlapMap.cpp: (WebCore::operator<<): (WebCore::OverlapMapContainer::OverlapMapContainer): (WebCore::OverlapMapContainer::ClippingScope::ClippingScope): (WebCore::OverlapMapContainer::ClippingScope::childWithLayer const): (WebCore::OverlapMapContainer::ClippingScope::addChildWithLayerAndBounds): (WebCore::OverlapMapContainer::ClippingScope::addChild): (WebCore::OverlapMapContainer::ClippingScope::appendRect): (WebCore::OverlapMapContainer::clippingScopeContainingLayerChildRecursive): (WebCore::OverlapMapContainer::scopeContainingLayer const): (WebCore::OverlapMapContainer::rootScope const): (WebCore::OverlapMapContainer::rootScope): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::mergeClippingScopesRecursive): (WebCore::OverlapMapContainer::append): (WebCore::OverlapMapContainer::ensureClippingScopeForLayers): (WebCore::OverlapMapContainer::findClippingScopeForLayers const): (WebCore::OverlapMapContainer::recursiveOutputToStream const): (WebCore::OverlapMapContainer::dump const): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::OverlapMapContainer::rectList const): Deleted. * rendering/LayerOverlapMap.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::BackingSharingState::appendSharingLayer): (WebCore::RenderLayerCompositor::BackingSharingState::updateBeforeDescendantTraversal): (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::createsClippingScope): (WebCore::enclosingClippingScopes): (WebCore::RenderLayerCompositor::addToOverlapMap const): (WebCore::RenderLayerCompositor::updateOverlapMap const): (WebCore::RenderLayerCompositor::layerOverlaps const): * rendering/RenderLayerCompositor.h: Source/WebCore/../../LayoutTests: * TestExpectations: * compositing/layer-creation/clipping-scope/nested-scroller-overlap-expected.txt: Added. * compositing/layer-creation/clipping-scope/nested-scroller-overlap.html: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller.html: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller.html: Added. * compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt: Added. * compositing/layer-creation/clipping-scope/scroller-with-negative-z-children.html: Added. * compositing/layer-creation/clipping-scope/shared-layers-in-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/shared-layers-in-scroller.html: Added. * platform/ios-wk2/TestExpectations: * platform/ios-wk2/compositing/layer-creation/clipping-scope/nested-scroller-overlap-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/shared-layers-in-scroller-expected.txt: Added. * platform/mac-wk2/TestExpectations: Canonical link: https://commits.webkit.org/212178@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245602 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-22 00:12:49 +00:00
class RenderLayer;
Move RenderLayerCompositor's OverlapMap to its own file https://bugs.webkit.org/show_bug.cgi?id=197915 Reviewed by Alex Christensen. Move OverlapMap to its own file. Make use of RectList, which was in the file but unused! Allocate OverlapMapContainer on the heap both to avoid header pollution of internals, and because they will get bigger in future. No behavior change. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/LayerOverlapMap.cpp: Added. (WebCore::RectList::append): (WebCore::RectList::intersects const): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::unite): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): * rendering/LayerOverlapMap.h: Added. (WebCore::LayerOverlapMap::isEmpty const): (WebCore::LayerOverlapMap::geometryMap const): (WebCore::LayerOverlapMap::geometryMap): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::RenderLayerCompositor::addToOverlapMap): (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): (WebCore::OverlapMapContainer::add): Deleted. (WebCore::OverlapMapContainer::overlapsLayers const): Deleted. (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::OverlapMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::add): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::overlapsLayers const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::isEmpty const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::pushCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::popCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::append): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::intersects const): Deleted. * rendering/RenderLayerCompositor.h: Canonical link: https://commits.webkit.org/212039@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-15 15:59:21 +00:00
class LayerOverlapMap {
WTF_MAKE_NONCOPYABLE(LayerOverlapMap);
public:
Layer flashing and poor perf during scrolling of message list on gmail.com and hotmail.com - overlap testing needs to constrained to clipping scopes https://bugs.webkit.org/show_bug.cgi?id=198091 <rdar://problem/49403082> Reviewed by Antti Koivisto. Source/WebCore: When overflow:scroll is scrolled asynchronously, we need to have already created compositing layers where necessary for clipped-out layers in the scrolled content so that we have something to reveal. We also have ensure that layers inside the scroller (but scrolled out of view) don't trigger overlap with layers outside the scroller. All this has to work when the containing block hierarchy (clipping/scrolling) doesn't match the paint order hierarchy (structure of the z-order and compositing trees). Overlap testing previously simply used a list of rectangles per compositing container (OverlapMapContainer). This is a series of layer bounds, built up as we traver the layer tree in z-order. Layers contribute to container N-2, and test against container N-1. To handle overlap with non-stacking-context scrollers, introduce the concept of a ClippingScope, which encompasses a set of layers sharing the same composited-scrolling containing-block ancestor. Within a ClippingScope, layer bounds are computed unclipped. Between them, bounds are tested clipped. Conceptually, each OverlapMapContainer has a tree of ClippingScopes (reflecting the containing-block order tree of composited overflow scroll), and rects are added to the appropriate ClippingScope. This tree is currently always root-relative; the root node is the RenderView's RenderLayer, and will accumulate the bounds of layers not inside composited overflow scroll (just like the old code). When a OverlapMapContainer is popped, the list of rectangles in its ClippingScope tree is merged with that of the previous container. Tests: compositing/layer-creation/clipping-scope/nested-scroller-overlap.html compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller.html compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller.html compositing/layer-creation/clipping-scope/scroller-with-negative-z-children.html compositing/layer-creation/clipping-scope/shared-layers-in-scroller.html * rendering/LayerOverlapMap.cpp: (WebCore::operator<<): (WebCore::OverlapMapContainer::OverlapMapContainer): (WebCore::OverlapMapContainer::ClippingScope::ClippingScope): (WebCore::OverlapMapContainer::ClippingScope::childWithLayer const): (WebCore::OverlapMapContainer::ClippingScope::addChildWithLayerAndBounds): (WebCore::OverlapMapContainer::ClippingScope::addChild): (WebCore::OverlapMapContainer::ClippingScope::appendRect): (WebCore::OverlapMapContainer::clippingScopeContainingLayerChildRecursive): (WebCore::OverlapMapContainer::scopeContainingLayer const): (WebCore::OverlapMapContainer::rootScope const): (WebCore::OverlapMapContainer::rootScope): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::mergeClippingScopesRecursive): (WebCore::OverlapMapContainer::append): (WebCore::OverlapMapContainer::ensureClippingScopeForLayers): (WebCore::OverlapMapContainer::findClippingScopeForLayers const): (WebCore::OverlapMapContainer::recursiveOutputToStream const): (WebCore::OverlapMapContainer::dump const): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::OverlapMapContainer::rectList const): Deleted. * rendering/LayerOverlapMap.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::BackingSharingState::appendSharingLayer): (WebCore::RenderLayerCompositor::BackingSharingState::updateBeforeDescendantTraversal): (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::createsClippingScope): (WebCore::enclosingClippingScopes): (WebCore::RenderLayerCompositor::addToOverlapMap const): (WebCore::RenderLayerCompositor::updateOverlapMap const): (WebCore::RenderLayerCompositor::layerOverlaps const): * rendering/RenderLayerCompositor.h: Source/WebCore/../../LayoutTests: * TestExpectations: * compositing/layer-creation/clipping-scope/nested-scroller-overlap-expected.txt: Added. * compositing/layer-creation/clipping-scope/nested-scroller-overlap.html: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller.html: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller.html: Added. * compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt: Added. * compositing/layer-creation/clipping-scope/scroller-with-negative-z-children.html: Added. * compositing/layer-creation/clipping-scope/shared-layers-in-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/shared-layers-in-scroller.html: Added. * platform/ios-wk2/TestExpectations: * platform/ios-wk2/compositing/layer-creation/clipping-scope/nested-scroller-overlap-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/shared-layers-in-scroller-expected.txt: Added. * platform/mac-wk2/TestExpectations: Canonical link: https://commits.webkit.org/212178@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245602 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-22 00:12:49 +00:00
LayerOverlapMap(const RenderLayer& rootLayer);
Move RenderLayerCompositor's OverlapMap to its own file https://bugs.webkit.org/show_bug.cgi?id=197915 Reviewed by Alex Christensen. Move OverlapMap to its own file. Make use of RectList, which was in the file but unused! Allocate OverlapMapContainer on the heap both to avoid header pollution of internals, and because they will get bigger in future. No behavior change. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/LayerOverlapMap.cpp: Added. (WebCore::RectList::append): (WebCore::RectList::intersects const): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::unite): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): * rendering/LayerOverlapMap.h: Added. (WebCore::LayerOverlapMap::isEmpty const): (WebCore::LayerOverlapMap::geometryMap const): (WebCore::LayerOverlapMap::geometryMap): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::RenderLayerCompositor::addToOverlapMap): (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): (WebCore::OverlapMapContainer::add): Deleted. (WebCore::OverlapMapContainer::overlapsLayers const): Deleted. (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::OverlapMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::add): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::overlapsLayers const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::isEmpty const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::pushCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::popCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::append): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::intersects const): Deleted. * rendering/RenderLayerCompositor.h: Canonical link: https://commits.webkit.org/212039@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-15 15:59:21 +00:00
~LayerOverlapMap();
Layer flashing and poor perf during scrolling of message list on gmail.com and hotmail.com - overlap testing needs to constrained to clipping scopes https://bugs.webkit.org/show_bug.cgi?id=198091 <rdar://problem/49403082> Reviewed by Antti Koivisto. Source/WebCore: When overflow:scroll is scrolled asynchronously, we need to have already created compositing layers where necessary for clipped-out layers in the scrolled content so that we have something to reveal. We also have ensure that layers inside the scroller (but scrolled out of view) don't trigger overlap with layers outside the scroller. All this has to work when the containing block hierarchy (clipping/scrolling) doesn't match the paint order hierarchy (structure of the z-order and compositing trees). Overlap testing previously simply used a list of rectangles per compositing container (OverlapMapContainer). This is a series of layer bounds, built up as we traver the layer tree in z-order. Layers contribute to container N-2, and test against container N-1. To handle overlap with non-stacking-context scrollers, introduce the concept of a ClippingScope, which encompasses a set of layers sharing the same composited-scrolling containing-block ancestor. Within a ClippingScope, layer bounds are computed unclipped. Between them, bounds are tested clipped. Conceptually, each OverlapMapContainer has a tree of ClippingScopes (reflecting the containing-block order tree of composited overflow scroll), and rects are added to the appropriate ClippingScope. This tree is currently always root-relative; the root node is the RenderView's RenderLayer, and will accumulate the bounds of layers not inside composited overflow scroll (just like the old code). When a OverlapMapContainer is popped, the list of rectangles in its ClippingScope tree is merged with that of the previous container. Tests: compositing/layer-creation/clipping-scope/nested-scroller-overlap.html compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller.html compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller.html compositing/layer-creation/clipping-scope/scroller-with-negative-z-children.html compositing/layer-creation/clipping-scope/shared-layers-in-scroller.html * rendering/LayerOverlapMap.cpp: (WebCore::operator<<): (WebCore::OverlapMapContainer::OverlapMapContainer): (WebCore::OverlapMapContainer::ClippingScope::ClippingScope): (WebCore::OverlapMapContainer::ClippingScope::childWithLayer const): (WebCore::OverlapMapContainer::ClippingScope::addChildWithLayerAndBounds): (WebCore::OverlapMapContainer::ClippingScope::addChild): (WebCore::OverlapMapContainer::ClippingScope::appendRect): (WebCore::OverlapMapContainer::clippingScopeContainingLayerChildRecursive): (WebCore::OverlapMapContainer::scopeContainingLayer const): (WebCore::OverlapMapContainer::rootScope const): (WebCore::OverlapMapContainer::rootScope): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::mergeClippingScopesRecursive): (WebCore::OverlapMapContainer::append): (WebCore::OverlapMapContainer::ensureClippingScopeForLayers): (WebCore::OverlapMapContainer::findClippingScopeForLayers const): (WebCore::OverlapMapContainer::recursiveOutputToStream const): (WebCore::OverlapMapContainer::dump const): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::OverlapMapContainer::rectList const): Deleted. * rendering/LayerOverlapMap.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::BackingSharingState::appendSharingLayer): (WebCore::RenderLayerCompositor::BackingSharingState::updateBeforeDescendantTraversal): (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::createsClippingScope): (WebCore::enclosingClippingScopes): (WebCore::RenderLayerCompositor::addToOverlapMap const): (WebCore::RenderLayerCompositor::updateOverlapMap const): (WebCore::RenderLayerCompositor::layerOverlaps const): * rendering/RenderLayerCompositor.h: Source/WebCore/../../LayoutTests: * TestExpectations: * compositing/layer-creation/clipping-scope/nested-scroller-overlap-expected.txt: Added. * compositing/layer-creation/clipping-scope/nested-scroller-overlap.html: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller.html: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller.html: Added. * compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt: Added. * compositing/layer-creation/clipping-scope/scroller-with-negative-z-children.html: Added. * compositing/layer-creation/clipping-scope/shared-layers-in-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/shared-layers-in-scroller.html: Added. * platform/ios-wk2/TestExpectations: * platform/ios-wk2/compositing/layer-creation/clipping-scope/nested-scroller-overlap-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/shared-layers-in-scroller-expected.txt: Added. * platform/mac-wk2/TestExpectations: Canonical link: https://commits.webkit.org/212178@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245602 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-22 00:12:49 +00:00
struct LayerAndBounds {
RenderLayer& layer;
LayoutRect bounds;
};
Move RenderLayerCompositor's OverlapMap to its own file https://bugs.webkit.org/show_bug.cgi?id=197915 Reviewed by Alex Christensen. Move OverlapMap to its own file. Make use of RectList, which was in the file but unused! Allocate OverlapMapContainer on the heap both to avoid header pollution of internals, and because they will get bigger in future. No behavior change. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/LayerOverlapMap.cpp: Added. (WebCore::RectList::append): (WebCore::RectList::intersects const): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::unite): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): * rendering/LayerOverlapMap.h: Added. (WebCore::LayerOverlapMap::isEmpty const): (WebCore::LayerOverlapMap::geometryMap const): (WebCore::LayerOverlapMap::geometryMap): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::RenderLayerCompositor::addToOverlapMap): (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): (WebCore::OverlapMapContainer::add): Deleted. (WebCore::OverlapMapContainer::overlapsLayers const): Deleted. (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::OverlapMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::add): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::overlapsLayers const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::isEmpty const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::pushCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::popCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::append): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::intersects const): Deleted. * rendering/RenderLayerCompositor.h: Canonical link: https://commits.webkit.org/212039@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-15 15:59:21 +00:00
Layer flashing and poor perf during scrolling of message list on gmail.com and hotmail.com - overlap testing needs to constrained to clipping scopes https://bugs.webkit.org/show_bug.cgi?id=198091 <rdar://problem/49403082> Reviewed by Antti Koivisto. Source/WebCore: When overflow:scroll is scrolled asynchronously, we need to have already created compositing layers where necessary for clipped-out layers in the scrolled content so that we have something to reveal. We also have ensure that layers inside the scroller (but scrolled out of view) don't trigger overlap with layers outside the scroller. All this has to work when the containing block hierarchy (clipping/scrolling) doesn't match the paint order hierarchy (structure of the z-order and compositing trees). Overlap testing previously simply used a list of rectangles per compositing container (OverlapMapContainer). This is a series of layer bounds, built up as we traver the layer tree in z-order. Layers contribute to container N-2, and test against container N-1. To handle overlap with non-stacking-context scrollers, introduce the concept of a ClippingScope, which encompasses a set of layers sharing the same composited-scrolling containing-block ancestor. Within a ClippingScope, layer bounds are computed unclipped. Between them, bounds are tested clipped. Conceptually, each OverlapMapContainer has a tree of ClippingScopes (reflecting the containing-block order tree of composited overflow scroll), and rects are added to the appropriate ClippingScope. This tree is currently always root-relative; the root node is the RenderView's RenderLayer, and will accumulate the bounds of layers not inside composited overflow scroll (just like the old code). When a OverlapMapContainer is popped, the list of rectangles in its ClippingScope tree is merged with that of the previous container. Tests: compositing/layer-creation/clipping-scope/nested-scroller-overlap.html compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller.html compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller.html compositing/layer-creation/clipping-scope/scroller-with-negative-z-children.html compositing/layer-creation/clipping-scope/shared-layers-in-scroller.html * rendering/LayerOverlapMap.cpp: (WebCore::operator<<): (WebCore::OverlapMapContainer::OverlapMapContainer): (WebCore::OverlapMapContainer::ClippingScope::ClippingScope): (WebCore::OverlapMapContainer::ClippingScope::childWithLayer const): (WebCore::OverlapMapContainer::ClippingScope::addChildWithLayerAndBounds): (WebCore::OverlapMapContainer::ClippingScope::addChild): (WebCore::OverlapMapContainer::ClippingScope::appendRect): (WebCore::OverlapMapContainer::clippingScopeContainingLayerChildRecursive): (WebCore::OverlapMapContainer::scopeContainingLayer const): (WebCore::OverlapMapContainer::rootScope const): (WebCore::OverlapMapContainer::rootScope): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::mergeClippingScopesRecursive): (WebCore::OverlapMapContainer::append): (WebCore::OverlapMapContainer::ensureClippingScopeForLayers): (WebCore::OverlapMapContainer::findClippingScopeForLayers const): (WebCore::OverlapMapContainer::recursiveOutputToStream const): (WebCore::OverlapMapContainer::dump const): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::OverlapMapContainer::rectList const): Deleted. * rendering/LayerOverlapMap.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::BackingSharingState::appendSharingLayer): (WebCore::RenderLayerCompositor::BackingSharingState::updateBeforeDescendantTraversal): (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::createsClippingScope): (WebCore::enclosingClippingScopes): (WebCore::RenderLayerCompositor::addToOverlapMap const): (WebCore::RenderLayerCompositor::updateOverlapMap const): (WebCore::RenderLayerCompositor::layerOverlaps const): * rendering/RenderLayerCompositor.h: Source/WebCore/../../LayoutTests: * TestExpectations: * compositing/layer-creation/clipping-scope/nested-scroller-overlap-expected.txt: Added. * compositing/layer-creation/clipping-scope/nested-scroller-overlap.html: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller.html: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller.html: Added. * compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt: Added. * compositing/layer-creation/clipping-scope/scroller-with-negative-z-children.html: Added. * compositing/layer-creation/clipping-scope/shared-layers-in-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/shared-layers-in-scroller.html: Added. * platform/ios-wk2/TestExpectations: * platform/ios-wk2/compositing/layer-creation/clipping-scope/nested-scroller-overlap-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/shared-layers-in-scroller-expected.txt: Added. * platform/mac-wk2/TestExpectations: Canonical link: https://commits.webkit.org/212178@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245602 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-22 00:12:49 +00:00
void add(const RenderLayer&, const LayoutRect&, const Vector<LayerAndBounds>& enclosingClippingLayers);
bool overlapsLayers(const RenderLayer&, const LayoutRect&, const Vector<LayerAndBounds>& enclosingClippingLayers) const;
Move RenderLayerCompositor's OverlapMap to its own file https://bugs.webkit.org/show_bug.cgi?id=197915 Reviewed by Alex Christensen. Move OverlapMap to its own file. Make use of RectList, which was in the file but unused! Allocate OverlapMapContainer on the heap both to avoid header pollution of internals, and because they will get bigger in future. No behavior change. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/LayerOverlapMap.cpp: Added. (WebCore::RectList::append): (WebCore::RectList::intersects const): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::unite): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): * rendering/LayerOverlapMap.h: Added. (WebCore::LayerOverlapMap::isEmpty const): (WebCore::LayerOverlapMap::geometryMap const): (WebCore::LayerOverlapMap::geometryMap): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::RenderLayerCompositor::addToOverlapMap): (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): (WebCore::OverlapMapContainer::add): Deleted. (WebCore::OverlapMapContainer::overlapsLayers const): Deleted. (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::OverlapMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::add): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::overlapsLayers const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::isEmpty const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::pushCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::popCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::append): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::intersects const): Deleted. * rendering/RenderLayerCompositor.h: Canonical link: https://commits.webkit.org/212039@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-15 15:59:21 +00:00
bool isEmpty() const { return m_isEmpty; }
void pushCompositingContainer();
void popCompositingContainer();
const RenderGeometryMap& geometryMap() const { return m_geometryMap; }
RenderGeometryMap& geometryMap() { return m_geometryMap; }
const Vector<std::unique_ptr<OverlapMapContainer>>& overlapStack() const { return m_overlapStack; }
Move RenderLayerCompositor's OverlapMap to its own file https://bugs.webkit.org/show_bug.cgi?id=197915 Reviewed by Alex Christensen. Move OverlapMap to its own file. Make use of RectList, which was in the file but unused! Allocate OverlapMapContainer on the heap both to avoid header pollution of internals, and because they will get bigger in future. No behavior change. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/LayerOverlapMap.cpp: Added. (WebCore::RectList::append): (WebCore::RectList::intersects const): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::unite): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): * rendering/LayerOverlapMap.h: Added. (WebCore::LayerOverlapMap::isEmpty const): (WebCore::LayerOverlapMap::geometryMap const): (WebCore::LayerOverlapMap::geometryMap): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::RenderLayerCompositor::addToOverlapMap): (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): (WebCore::OverlapMapContainer::add): Deleted. (WebCore::OverlapMapContainer::overlapsLayers const): Deleted. (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::OverlapMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::add): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::overlapsLayers const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::isEmpty const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::pushCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::popCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::append): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::intersects const): Deleted. * rendering/RenderLayerCompositor.h: Canonical link: https://commits.webkit.org/212039@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-15 15:59:21 +00:00
private:
Vector<std::unique_ptr<OverlapMapContainer>> m_overlapStack;
RenderGeometryMap m_geometryMap;
Layer flashing and poor perf during scrolling of message list on gmail.com and hotmail.com - overlap testing needs to constrained to clipping scopes https://bugs.webkit.org/show_bug.cgi?id=198091 <rdar://problem/49403082> Reviewed by Antti Koivisto. Source/WebCore: When overflow:scroll is scrolled asynchronously, we need to have already created compositing layers where necessary for clipped-out layers in the scrolled content so that we have something to reveal. We also have ensure that layers inside the scroller (but scrolled out of view) don't trigger overlap with layers outside the scroller. All this has to work when the containing block hierarchy (clipping/scrolling) doesn't match the paint order hierarchy (structure of the z-order and compositing trees). Overlap testing previously simply used a list of rectangles per compositing container (OverlapMapContainer). This is a series of layer bounds, built up as we traver the layer tree in z-order. Layers contribute to container N-2, and test against container N-1. To handle overlap with non-stacking-context scrollers, introduce the concept of a ClippingScope, which encompasses a set of layers sharing the same composited-scrolling containing-block ancestor. Within a ClippingScope, layer bounds are computed unclipped. Between them, bounds are tested clipped. Conceptually, each OverlapMapContainer has a tree of ClippingScopes (reflecting the containing-block order tree of composited overflow scroll), and rects are added to the appropriate ClippingScope. This tree is currently always root-relative; the root node is the RenderView's RenderLayer, and will accumulate the bounds of layers not inside composited overflow scroll (just like the old code). When a OverlapMapContainer is popped, the list of rectangles in its ClippingScope tree is merged with that of the previous container. Tests: compositing/layer-creation/clipping-scope/nested-scroller-overlap.html compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller.html compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller.html compositing/layer-creation/clipping-scope/scroller-with-negative-z-children.html compositing/layer-creation/clipping-scope/shared-layers-in-scroller.html * rendering/LayerOverlapMap.cpp: (WebCore::operator<<): (WebCore::OverlapMapContainer::OverlapMapContainer): (WebCore::OverlapMapContainer::ClippingScope::ClippingScope): (WebCore::OverlapMapContainer::ClippingScope::childWithLayer const): (WebCore::OverlapMapContainer::ClippingScope::addChildWithLayerAndBounds): (WebCore::OverlapMapContainer::ClippingScope::addChild): (WebCore::OverlapMapContainer::ClippingScope::appendRect): (WebCore::OverlapMapContainer::clippingScopeContainingLayerChildRecursive): (WebCore::OverlapMapContainer::scopeContainingLayer const): (WebCore::OverlapMapContainer::rootScope const): (WebCore::OverlapMapContainer::rootScope): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::mergeClippingScopesRecursive): (WebCore::OverlapMapContainer::append): (WebCore::OverlapMapContainer::ensureClippingScopeForLayers): (WebCore::OverlapMapContainer::findClippingScopeForLayers const): (WebCore::OverlapMapContainer::recursiveOutputToStream const): (WebCore::OverlapMapContainer::dump const): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::OverlapMapContainer::rectList const): Deleted. * rendering/LayerOverlapMap.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::BackingSharingState::appendSharingLayer): (WebCore::RenderLayerCompositor::BackingSharingState::updateBeforeDescendantTraversal): (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::createsClippingScope): (WebCore::enclosingClippingScopes): (WebCore::RenderLayerCompositor::addToOverlapMap const): (WebCore::RenderLayerCompositor::updateOverlapMap const): (WebCore::RenderLayerCompositor::layerOverlaps const): * rendering/RenderLayerCompositor.h: Source/WebCore/../../LayoutTests: * TestExpectations: * compositing/layer-creation/clipping-scope/nested-scroller-overlap-expected.txt: Added. * compositing/layer-creation/clipping-scope/nested-scroller-overlap.html: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller.html: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller.html: Added. * compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt: Added. * compositing/layer-creation/clipping-scope/scroller-with-negative-z-children.html: Added. * compositing/layer-creation/clipping-scope/shared-layers-in-scroller-expected.txt: Added. * compositing/layer-creation/clipping-scope/shared-layers-in-scroller.html: Added. * platform/ios-wk2/TestExpectations: * platform/ios-wk2/compositing/layer-creation/clipping-scope/nested-scroller-overlap-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/overlap-constrained-inside-scroller-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/overlap-constrained-inside-stacking-context-scroller-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/scroller-with-negative-z-children-expected.txt: Added. * platform/ios-wk2/compositing/layer-creation/clipping-scope/shared-layers-in-scroller-expected.txt: Added. * platform/mac-wk2/TestExpectations: Canonical link: https://commits.webkit.org/212178@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245602 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-22 00:12:49 +00:00
const RenderLayer& m_rootLayer;
Move RenderLayerCompositor's OverlapMap to its own file https://bugs.webkit.org/show_bug.cgi?id=197915 Reviewed by Alex Christensen. Move OverlapMap to its own file. Make use of RectList, which was in the file but unused! Allocate OverlapMapContainer on the heap both to avoid header pollution of internals, and because they will get bigger in future. No behavior change. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/LayerOverlapMap.cpp: Added. (WebCore::RectList::append): (WebCore::RectList::intersects const): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::unite): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): * rendering/LayerOverlapMap.h: Added. (WebCore::LayerOverlapMap::isEmpty const): (WebCore::LayerOverlapMap::geometryMap const): (WebCore::LayerOverlapMap::geometryMap): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::RenderLayerCompositor::addToOverlapMap): (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): (WebCore::OverlapMapContainer::add): Deleted. (WebCore::OverlapMapContainer::overlapsLayers const): Deleted. (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::OverlapMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::add): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::overlapsLayers const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::isEmpty const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::pushCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::popCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::append): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::intersects const): Deleted. * rendering/RenderLayerCompositor.h: Canonical link: https://commits.webkit.org/212039@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-15 15:59:21 +00:00
bool m_isEmpty { true };
};
TextStream& operator<<(TextStream&, const LayerOverlapMap&);
Move RenderLayerCompositor's OverlapMap to its own file https://bugs.webkit.org/show_bug.cgi?id=197915 Reviewed by Alex Christensen. Move OverlapMap to its own file. Make use of RectList, which was in the file but unused! Allocate OverlapMapContainer on the heap both to avoid header pollution of internals, and because they will get bigger in future. No behavior change. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * rendering/LayerOverlapMap.cpp: Added. (WebCore::RectList::append): (WebCore::RectList::intersects const): (WebCore::OverlapMapContainer::add): (WebCore::OverlapMapContainer::overlapsLayers const): (WebCore::OverlapMapContainer::unite): (WebCore::LayerOverlapMap::LayerOverlapMap): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::popCompositingContainer): * rendering/LayerOverlapMap.h: Added. (WebCore::LayerOverlapMap::isEmpty const): (WebCore::LayerOverlapMap::geometryMap const): (WebCore::LayerOverlapMap::geometryMap): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::updateCompositingLayers): (WebCore::RenderLayerCompositor::computeCompositingRequirements): (WebCore::RenderLayerCompositor::traverseUnchangedSubtree): (WebCore::RenderLayerCompositor::computeExtent const): (WebCore::RenderLayerCompositor::addToOverlapMap): (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): (WebCore::OverlapMapContainer::add): Deleted. (WebCore::OverlapMapContainer::overlapsLayers const): Deleted. (WebCore::OverlapMapContainer::unite): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::OverlapMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::add): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::overlapsLayers const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::isEmpty const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::pushCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::popCompositingContainer): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap const): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::geometryMap): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::append): Deleted. (WebCore::RenderLayerCompositor::OverlapMap::RectList::intersects const): Deleted. * rendering/RenderLayerCompositor.h: Canonical link: https://commits.webkit.org/212039@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245326 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-15 15:59:21 +00:00
} // namespace WebCore