Separate VisualViewport layer tree creation from attachment.
This paves the way for deferring attachment. With root layer scrolling the layer passed to WebViewImpl::setRootGraphicsLayer will be the LayoutView's main GraphicsLayer, which does not exist until after the compositing update. BUG=698464 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Review-Url: https://codereview.chromium.org/2735543002 Cr-Commit-Position: refs/heads/master@{#454934}
This commit is contained in:
third_party/WebKit
LayoutTests
FlagExpectations
Source
core
frame
layout
loader
web
@ -449,7 +449,7 @@ Bug(none) compositing/video/video-poster.html [ Crash Failure ]
|
||||
Bug(none) compositing/video/video-reflection.html [ Crash Failure ]
|
||||
Bug(none) compositing/visibility/layer-visible-content.html [ Failure ]
|
||||
Bug(none) compositing/visibility/overlays-persist-on-navigation.html [ Crash ]
|
||||
Bug(none) compositing/visibility/overlays.html [ Crash ]
|
||||
Bug(none) compositing/visibility/overlays.html [ Failure Crash ]
|
||||
Bug(none) compositing/visibility/visibility-image-layers-dynamic.html [ Crash Failure ]
|
||||
Bug(none) compositing/visibility/visibility-image-layers.html [ Failure ]
|
||||
Bug(none) compositing/visibility/visibility-simple-video-layer.html [ Failure ]
|
||||
@ -595,7 +595,7 @@ Bug(none) fast/events/scale-and-scroll-window.html [ Crash Timeout ]
|
||||
Bug(none) fast/events/scroll-after-click-on-tab-index.html [ Failure ]
|
||||
Bug(none) fast/events/space-scroll-textinput-canceled.html [ Failure ]
|
||||
Bug(none) fast/events/touch/compositor-touch-hit-rects-animation.html [ Failure ]
|
||||
Bug(none) fast/events/touch/compositor-touch-hit-rects-global.html [ Crash ]
|
||||
Bug(none) fast/events/touch/compositor-touch-hit-rects-global.html [ Failure Crash ]
|
||||
Bug(none) fast/events/touch/compositor-touch-hit-rects-many.html [ Failure ]
|
||||
Bug(none) fast/events/touch/compositor-touch-hit-rects-non-composited-scroll.html [ Failure ]
|
||||
Bug(none) fast/events/touch/compositor-touch-hit-rects-scroll.html [ Failure ]
|
||||
@ -1588,7 +1588,7 @@ crbug.com/675805 fast/text/complex-text-opacity.html [ Failure ]
|
||||
|
||||
# Failures due to frame scrollbars not painted
|
||||
crbug.com/589279 css3/blending/background-blend-mode-data-uri-svg-image.html [ Failure ]
|
||||
|
||||
|
||||
# Need to write SPv2 version of this code.
|
||||
crbug.com/157218 compositing/overflow/border-radius-styles-with-composited-child.html [ Failure ]
|
||||
crbug.com/157218 compositing/overflow/siblings-with-border-radius-ancestor.html [ Failure ]
|
||||
@ -1645,7 +1645,7 @@ Bug(none) virtual/threaded/inspector/ [ Skip ]
|
||||
Bug(none) virtual/threaded/fast/scroll-behavior/ [ Skip ]
|
||||
Bug(none) virtual/threaded/compositing/visibility/layer-visible-content.html [ Failure ]
|
||||
Bug(none) virtual/threaded/compositing/visibility/overlays-persist-on-navigation.html [ Crash ]
|
||||
Bug(none) virtual/threaded/compositing/visibility/overlays.html [ Crash ]
|
||||
Bug(none) virtual/threaded/compositing/visibility/overlays.html [ Failure Crash ]
|
||||
Bug(none) virtual/threaded/compositing/visibility/visibility-image-layers-dynamic.html [ Crash Failure ]
|
||||
Bug(none) virtual/threaded/compositing/visibility/visibility-image-layers.html [ Failure ]
|
||||
Bug(none) virtual/threaded/compositing/visibility/visibility-simple-video-layer.html [ Failure ]
|
||||
|
@ -319,30 +319,57 @@ bool VisualViewport::magnifyScaleAroundAnchor(float magnifyDelta,
|
||||
return true;
|
||||
}
|
||||
|
||||
// Modifies the top of the graphics layer tree to add layers needed to support
|
||||
// the inner/outer viewport fixed-position model for pinch zoom. When finished,
|
||||
// the tree will look like this (with * denoting added layers):
|
||||
//
|
||||
// *rootTransformLayer
|
||||
// +- *innerViewportContainerLayer (fixed pos container)
|
||||
// +- *overscrollElasticityLayer
|
||||
// | +- *pageScaleLayer
|
||||
// | +- *innerViewportScrollLayer
|
||||
// | +-- overflowControlsHostLayer (root layer)
|
||||
// | | [ owned by PaintLayerCompositor ]
|
||||
// | +-- outerViewportContainerLayer (fixed pos container)
|
||||
// | | [frame container layer in PaintLayerCompositor]
|
||||
// | | +-- outerViewportScrollLayer
|
||||
// | | | [frame scroll layer in PaintLayerCompositor]
|
||||
// | | +-- content layers ...
|
||||
// +- *PageOverlay for InspectorOverlay
|
||||
// +- *PageOverlay for ColorOverlay
|
||||
// +- horizontalScrollbarLayer [ owned by PaintLayerCompositor ]
|
||||
// +- verticalScrollbarLayer [ owned by PaintLayerCompositor ]
|
||||
// +- scroll corner (non-overlay only) [ owned by PaintLayerCompositor ]
|
||||
//
|
||||
void VisualViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot) {
|
||||
TRACE_EVENT1("blink", "VisualViewport::attachToLayerTree",
|
||||
void VisualViewport::createLayerTree() {
|
||||
if (m_innerViewportScrollLayer)
|
||||
return;
|
||||
|
||||
DCHECK(!m_overlayScrollbarHorizontal && !m_overlayScrollbarVertical &&
|
||||
!m_overscrollElasticityLayer && !m_pageScaleLayer &&
|
||||
!m_innerViewportContainerLayer);
|
||||
|
||||
// FIXME: The root transform layer should only be created on demand.
|
||||
m_rootTransformLayer = GraphicsLayer::create(this);
|
||||
m_innerViewportContainerLayer = GraphicsLayer::create(this);
|
||||
m_overscrollElasticityLayer = GraphicsLayer::create(this);
|
||||
m_pageScaleLayer = GraphicsLayer::create(this);
|
||||
m_innerViewportScrollLayer = GraphicsLayer::create(this);
|
||||
m_overlayScrollbarHorizontal = GraphicsLayer::create(this);
|
||||
m_overlayScrollbarVertical = GraphicsLayer::create(this);
|
||||
|
||||
ScrollingCoordinator* coordinator = frameHost().page().scrollingCoordinator();
|
||||
DCHECK(coordinator);
|
||||
coordinator->setLayerIsContainerForFixedPositionLayers(
|
||||
m_innerViewportScrollLayer.get(), true);
|
||||
|
||||
// Set masks to bounds so the compositor doesn't clobber a manually
|
||||
// set inner viewport container layer size.
|
||||
m_innerViewportContainerLayer->setMasksToBounds(
|
||||
frameHost().page().settings().getMainFrameClipsContent());
|
||||
m_innerViewportContainerLayer->setSize(FloatSize(m_size));
|
||||
|
||||
m_innerViewportScrollLayer->platformLayer()->setScrollClipLayer(
|
||||
m_innerViewportContainerLayer->platformLayer());
|
||||
m_innerViewportScrollLayer->platformLayer()->setUserScrollable(true, true);
|
||||
if (mainFrame()) {
|
||||
if (Document* document = mainFrame()->document()) {
|
||||
m_innerViewportScrollLayer->setElementId(createCompositorElementId(
|
||||
DOMNodeIds::idForNode(document), CompositorSubElementId::Viewport));
|
||||
}
|
||||
}
|
||||
|
||||
m_rootTransformLayer->addChild(m_innerViewportContainerLayer.get());
|
||||
m_innerViewportContainerLayer->addChild(m_overscrollElasticityLayer.get());
|
||||
m_overscrollElasticityLayer->addChild(m_pageScaleLayer.get());
|
||||
m_pageScaleLayer->addChild(m_innerViewportScrollLayer.get());
|
||||
|
||||
// Ensure this class is set as the scroll layer's ScrollableArea.
|
||||
coordinator->scrollableAreaScrollLayerDidChange(this);
|
||||
|
||||
initializeScrollbars();
|
||||
}
|
||||
|
||||
void VisualViewport::attachLayerTree(GraphicsLayer* currentLayerTreeRoot) {
|
||||
TRACE_EVENT1("blink", "VisualViewport::attachLayerTree",
|
||||
"currentLayerTreeRoot", (bool)currentLayerTreeRoot);
|
||||
if (!currentLayerTreeRoot) {
|
||||
if (m_innerViewportScrollLayer)
|
||||
@ -354,53 +381,7 @@ void VisualViewport::attachToLayerTree(GraphicsLayer* currentLayerTreeRoot) {
|
||||
currentLayerTreeRoot->parent() == m_innerViewportScrollLayer.get())
|
||||
return;
|
||||
|
||||
if (!m_innerViewportScrollLayer) {
|
||||
ASSERT(!m_overlayScrollbarHorizontal && !m_overlayScrollbarVertical &&
|
||||
!m_overscrollElasticityLayer && !m_pageScaleLayer &&
|
||||
!m_innerViewportContainerLayer);
|
||||
|
||||
// FIXME: The root transform layer should only be created on demand.
|
||||
m_rootTransformLayer = GraphicsLayer::create(this);
|
||||
m_innerViewportContainerLayer = GraphicsLayer::create(this);
|
||||
m_overscrollElasticityLayer = GraphicsLayer::create(this);
|
||||
m_pageScaleLayer = GraphicsLayer::create(this);
|
||||
m_innerViewportScrollLayer = GraphicsLayer::create(this);
|
||||
m_overlayScrollbarHorizontal = GraphicsLayer::create(this);
|
||||
m_overlayScrollbarVertical = GraphicsLayer::create(this);
|
||||
|
||||
ScrollingCoordinator* coordinator =
|
||||
frameHost().page().scrollingCoordinator();
|
||||
ASSERT(coordinator);
|
||||
coordinator->setLayerIsContainerForFixedPositionLayers(
|
||||
m_innerViewportScrollLayer.get(), true);
|
||||
|
||||
// Set masks to bounds so the compositor doesn't clobber a manually
|
||||
// set inner viewport container layer size.
|
||||
m_innerViewportContainerLayer->setMasksToBounds(
|
||||
frameHost().page().settings().getMainFrameClipsContent());
|
||||
m_innerViewportContainerLayer->setSize(FloatSize(m_size));
|
||||
|
||||
m_innerViewportScrollLayer->platformLayer()->setScrollClipLayer(
|
||||
m_innerViewportContainerLayer->platformLayer());
|
||||
m_innerViewportScrollLayer->platformLayer()->setUserScrollable(true, true);
|
||||
if (mainFrame()) {
|
||||
if (Document* document = mainFrame()->document()) {
|
||||
m_innerViewportScrollLayer->setElementId(createCompositorElementId(
|
||||
DOMNodeIds::idForNode(document), CompositorSubElementId::Viewport));
|
||||
}
|
||||
}
|
||||
|
||||
m_rootTransformLayer->addChild(m_innerViewportContainerLayer.get());
|
||||
m_innerViewportContainerLayer->addChild(m_overscrollElasticityLayer.get());
|
||||
m_overscrollElasticityLayer->addChild(m_pageScaleLayer.get());
|
||||
m_pageScaleLayer->addChild(m_innerViewportScrollLayer.get());
|
||||
|
||||
// Ensure this class is set as the scroll layer's ScrollableArea.
|
||||
coordinator->scrollableAreaScrollLayerDidChange(this);
|
||||
|
||||
initializeScrollbars();
|
||||
}
|
||||
|
||||
DCHECK(m_innerViewportScrollLayer);
|
||||
m_innerViewportScrollLayer->removeAllChildren();
|
||||
m_innerViewportScrollLayer->addChild(currentLayerTreeRoot);
|
||||
}
|
||||
|
@ -62,6 +62,25 @@ class LocalFrame;
|
||||
// mechanisms. Its contents is the page's main FrameView, which corresponds to
|
||||
// the outer viewport. The inner viewport is always contained in the outer
|
||||
// viewport and can pan within it.
|
||||
//
|
||||
// When attached, the tree will look like this:
|
||||
//
|
||||
// VV::m_rootTransformLayer
|
||||
// +- VV::m_innerViewportContainerLayer
|
||||
// +- VV::m_overscrollElasticityLayer
|
||||
// | +- VV::m_pageScaleLayer
|
||||
// | +- VV::m_innerViewportScrollLayer
|
||||
// | +-- PLC::m_overflowControlsHostLayer
|
||||
// | +-- PLC::m_containerLayer (fixed pos container)
|
||||
// | +-- PLC::m_scrollLayer
|
||||
// | +-- PLC::m_rootContentLayer
|
||||
// | +-- LayoutView CompositedLayerMapping layers
|
||||
// +- PageOverlay for InspectorOverlay
|
||||
// +- PageOverlay for ColorOverlay
|
||||
// +- PLC::m_layerForHorizontalScrollbar
|
||||
// +- PLC::m_layerForVerticalScrollbar
|
||||
// +- PLC::m_layerForScrollCorner (non-overlay only)
|
||||
//
|
||||
class CORE_EXPORT VisualViewport final
|
||||
: public GarbageCollectedFinalized<VisualViewport>,
|
||||
public GraphicsLayerClient,
|
||||
@ -76,7 +95,8 @@ class CORE_EXPORT VisualViewport final
|
||||
|
||||
DECLARE_VIRTUAL_TRACE();
|
||||
|
||||
void attachToLayerTree(GraphicsLayer*);
|
||||
void createLayerTree();
|
||||
void attachLayerTree(GraphicsLayer*);
|
||||
|
||||
GraphicsLayer* rootGraphicsLayer() { return m_rootTransformLayer.get(); }
|
||||
GraphicsLayer* containerLayer() {
|
||||
|
@ -462,7 +462,7 @@ void PaintLayerCompositor::updateIfNeeded() {
|
||||
}
|
||||
|
||||
// Inform the inspector that the layer tree has changed.
|
||||
if (m_layoutView.frame()->isMainFrame())
|
||||
if (isMainFrame())
|
||||
probe::layerTreeDidChange(m_layoutView.frame());
|
||||
}
|
||||
|
||||
@ -723,7 +723,7 @@ std::unique_ptr<JSONObject> PaintLayerCompositor::layerTreeAsJSON(
|
||||
// root.
|
||||
GraphicsLayer* rootLayer = m_rootContentLayer.get();
|
||||
if (flags & LayerTreeIncludesRootLayer) {
|
||||
if (m_layoutView.frame()->isMainFrame()) {
|
||||
if (isMainFrame()) {
|
||||
while (rootLayer->parent())
|
||||
rootLayer = rootLayer->parent();
|
||||
} else {
|
||||
@ -1046,11 +1046,8 @@ void PaintLayerCompositor::updateOverflowControlsLayers() {
|
||||
// Main frame scrollbars should always be stuck to the sides of the screen (in
|
||||
// overscroll and in pinch-zoom), so make the parent for the scrollbars be the
|
||||
// viewport container layer.
|
||||
if (m_layoutView.frame()->isMainFrame()) {
|
||||
VisualViewport& visualViewport =
|
||||
m_layoutView.frameView()->page()->frameHost().visualViewport();
|
||||
controlsParent = visualViewport.containerLayer();
|
||||
}
|
||||
if (isMainFrame())
|
||||
controlsParent = visualViewport().containerLayer();
|
||||
|
||||
if (requiresHorizontalScrollbarLayer()) {
|
||||
if (!m_layerForHorizontalScrollbar) {
|
||||
@ -1119,6 +1116,9 @@ void PaintLayerCompositor::ensureRootLayer() {
|
||||
if (expectedAttachment == m_rootLayerAttachment)
|
||||
return;
|
||||
|
||||
if (isMainFrame())
|
||||
visualViewport().createLayerTree();
|
||||
|
||||
if (!m_rootContentLayer) {
|
||||
m_rootContentLayer = GraphicsLayer::create(this);
|
||||
IntRect overflowRect = m_layoutView.pixelSnappedLayoutOverflowRect();
|
||||
@ -1330,6 +1330,14 @@ DocumentLifecycle& PaintLayerCompositor::lifecycle() const {
|
||||
return m_layoutView.document().lifecycle();
|
||||
}
|
||||
|
||||
bool PaintLayerCompositor::isMainFrame() const {
|
||||
return m_layoutView.frame()->isMainFrame();
|
||||
}
|
||||
|
||||
VisualViewport& PaintLayerCompositor::visualViewport() const {
|
||||
return m_layoutView.frameView()->page()->frameHost().visualViewport();
|
||||
}
|
||||
|
||||
String PaintLayerCompositor::debugName(
|
||||
const GraphicsLayer* graphicsLayer) const {
|
||||
String name;
|
||||
|
@ -43,6 +43,7 @@ class Page;
|
||||
class LayoutPart;
|
||||
class Scrollbar;
|
||||
class ScrollingCoordinator;
|
||||
class VisualViewport;
|
||||
|
||||
enum CompositingUpdateType {
|
||||
CompositingUpdateNone,
|
||||
@ -244,6 +245,9 @@ class CORE_EXPORT PaintLayerCompositor final : public GraphicsLayerClient {
|
||||
// instance if any, else nullptr.
|
||||
Scrollbar* graphicsLayerToScrollbar(const GraphicsLayer*) const;
|
||||
|
||||
bool isMainFrame() const;
|
||||
VisualViewport& visualViewport() const;
|
||||
|
||||
LayoutView& m_layoutView;
|
||||
std::unique_ptr<GraphicsLayer> m_rootContentLayer;
|
||||
|
||||
|
@ -115,7 +115,7 @@ void EmptyChromeClient::attachRootGraphicsLayer(GraphicsLayer* layer,
|
||||
Page* page = localRoot ? localRoot->page() : nullptr;
|
||||
if (!page)
|
||||
return;
|
||||
page->frameHost().visualViewport().attachToLayerTree(layer);
|
||||
page->frameHost().visualViewport().attachLayerTree(layer);
|
||||
}
|
||||
|
||||
String EmptyChromeClient::acceptLanguages() {
|
||||
|
@ -3844,7 +3844,7 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* graphicsLayer) {
|
||||
DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
|
||||
|
||||
VisualViewport& visualViewport = page()->frameHost().visualViewport();
|
||||
visualViewport.attachToLayerTree(graphicsLayer);
|
||||
visualViewport.attachLayerTree(graphicsLayer);
|
||||
if (graphicsLayer) {
|
||||
m_rootGraphicsLayer = visualViewport.rootGraphicsLayer();
|
||||
m_visualViewportContainerLayer = visualViewport.containerLayer();
|
||||
|
Reference in New Issue
Block a user