Commit 0c415398 authored by Philip Rogers's avatar Philip Rogers Committed by Commit Bot

[BlinkGenPropertyTrees] Wire up popup painting

This patch fixes two bugs where popups were not painted:
1) Popups were not hooked up because the BGPT/SPV2 AttachRootLayer
function was not implemented on WebPagePopupImpl. This has been
implemented.
2) Popup layers were not painted. Popups are not attached to the
viewport layers and were not found via the recursive paint walk. Popups
are now special-cased so they are painted.

A DCHECK has been added in layer_tree_host to make this sort of bug
easier to debug. Instead of NPE in some random layer code, we now
DCHECK.

Bug: 853951
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux-blink-gen-property-trees;luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ia7bbcd4c27f860ada232d28c89ab672d60995aec
Reviewed-on: https://chromium-review.googlesource.com/1117216Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570960}
parent 62d16d51
......@@ -787,6 +787,21 @@ bool LayerTreeHost::DoUpdateLayers(Layer* root_layer) {
property_trees->AsTracedValue());
}
#if DCHECK_IS_ON()
// Ensure property tree nodes were created for all layers. When using layer
// lists, this can fail if blink doesn't setup layers or nodes correctly in
// |PaintArtifactCompositor|. When not using layer lists, this can fail if
// |PropertyTreeBuilder::BuildPropertyTrees| fails to create property tree
// nodes.
for (auto* layer : *this) {
DCHECK(property_trees_.effect_tree.Node(layer->effect_tree_index()));
DCHECK(
property_trees_.transform_tree.Node(layer->transform_tree_index()));
DCHECK(property_trees_.clip_tree.Node(layer->clip_tree_index()));
DCHECK(property_trees_.scroll_tree.Node(layer->scroll_tree_index()));
}
#endif
draw_property_utils::UpdatePropertyTrees(this, property_trees);
draw_property_utils::FindLayersThatNeedUpdates(this, property_trees,
&update_layer_list);
......
......@@ -222,7 +222,12 @@ class PagePopupChromeClient final : public EmptyChromeClient {
void AttachRootGraphicsLayer(GraphicsLayer* graphics_layer,
LocalFrame* local_root) override {
popup_->SetRootGraphicsLayer(graphics_layer);
popup_->SetRootLayer(graphics_layer ? graphics_layer->CcLayer() : nullptr);
}
void AttachRootLayer(scoped_refptr<cc::Layer> layer,
LocalFrame* local_root) override {
popup_->SetRootLayer(layer.get());
}
void SetToolTip(LocalFrame&,
......@@ -359,9 +364,8 @@ void WebPagePopupImpl::SetWindowRect(const IntRect& rect_in_screen) {
WidgetClient()->SetWindowRect(rect_in_screen);
}
void WebPagePopupImpl::SetRootGraphicsLayer(GraphicsLayer* layer) {
root_graphics_layer_ = layer;
root_layer_ = layer ? layer->CcLayer() : nullptr;
void WebPagePopupImpl::SetRootLayer(cc::Layer* layer) {
root_layer_ = layer;
is_accelerated_compositing_active_ = !!layer;
if (layer_tree_view_) {
......
......@@ -45,7 +45,6 @@ class Layer;
namespace blink {
class CompositorAnimationHost;
class GraphicsLayer;
class Page;
class PagePopupChromeClient;
class PagePopupClient;
......@@ -115,7 +114,7 @@ class CORE_EXPORT WebPagePopupImpl final : public WebPagePopup,
bool InitializePage();
void DestroyPage();
void InitializeLayerTreeView();
void SetRootGraphicsLayer(GraphicsLayer*);
void SetRootLayer(cc::Layer*);
WebRect WindowRectInScreen() const;
......@@ -128,7 +127,6 @@ class CORE_EXPORT WebPagePopupImpl final : public WebPagePopup,
WebLayerTreeView* layer_tree_view_ = nullptr;
scoped_refptr<cc::Layer> root_layer_;
GraphicsLayer* root_graphics_layer_ = nullptr;
std::unique_ptr<CompositorAnimationHost> animation_host_;
bool is_accelerated_compositing_active_ = false;
......
......@@ -730,6 +730,9 @@ GraphicsLayer* PaintLayerCompositor::RootGraphicsLayer() const {
GraphicsLayer* PaintLayerCompositor::PaintRootGraphicsLayer() const {
if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
if (layout_view_.GetDocument().GetPage()->GetChromeClient().IsPopup())
return RootGraphicsLayer();
// Start painting at the inner viewport container layer which is an ancestor
// of both the main contents layers and the scrollbar layers.
if (IsMainFrame() && GetVisualViewport().ContainerLayer())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment