Commit 3cea47a9 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

Composite fullscreen videos with composited descendants.

This fixes the referenced performance regression in which some such
videos stopped being composited.

Bug: 1108972

Change-Id: Ia77d33c1c50cf25427d825ae3969a120a8cde640
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2335648Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794573}
parent 6434438c
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater.h" #include "third_party/blink/renderer/core/paint/compositing/compositing_requirements_updater.h"
#include "base/macros.h" #include "base/macros.h"
#include "third_party/blink/renderer/core/html/media/html_media_element.h"
#include "third_party/blink/renderer/core/layout/layout_embedded_content.h" #include "third_party/blink/renderer/core/layout/layout_embedded_content.h"
#include "third_party/blink/renderer/core/layout/layout_view.h" #include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h" #include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h"
...@@ -183,6 +184,13 @@ static CompositingReasons SubtreeReasonsForCompositing( ...@@ -183,6 +184,13 @@ static CompositingReasons SubtreeReasonsForCompositing(
subtree_reasons |= CompositingReason::kIsolateCompositedDescendants; subtree_reasons |= CompositingReason::kIsolateCompositedDescendants;
} }
if (layer->GetLayoutObject().IsVideo() &&
To<HTMLMediaElement>(layer->GetLayoutObject().GetNode())
->IsFullscreen()) {
subtree_reasons |=
CompositingReason::kFullscreenVideoWithCompositedDescendants;
}
// A layer with preserve-3d or perspective only needs to be composited if // A layer with preserve-3d or perspective only needs to be composited if
// there are descendant layers that will be affected by the preserve-3d or // there are descendant layers that will be affected by the preserve-3d or
// perspective. // perspective.
......
...@@ -104,6 +104,9 @@ constexpr CompositingReasonStringMap kCompositingReasonsStringMap[] = { ...@@ -104,6 +104,9 @@ constexpr CompositingReasonStringMap kCompositingReasonsStringMap[] = {
{CompositingReason::kIsolateCompositedDescendants, {CompositingReason::kIsolateCompositedDescendants,
"isolateCompositedDescendants", "isolateCompositedDescendants",
"Should isolate descendants to apply a blend effect"}, "Should isolate descendants to apply a blend effect"},
{CompositingReason::kFullscreenVideoWithCompositedDescendants,
"fullscreenVideoWithCompositedDescendants",
"Is a fullscreen video element with composited descendants"},
{CompositingReason::kRoot, "root", "Is the root layer"}, {CompositingReason::kRoot, "root", "Is the root layer"},
{CompositingReason::kLayerForHorizontalScrollbar, {CompositingReason::kLayerForHorizontalScrollbar,
"layerForHorizontalScrollbar", "layerForHorizontalScrollbar",
......
...@@ -64,6 +64,7 @@ using CompositingReasons = uint64_t; ...@@ -64,6 +64,7 @@ using CompositingReasons = uint64_t;
V(PerspectiveWith3DDescendants) \ V(PerspectiveWith3DDescendants) \
V(Preserve3DWith3DDescendants) \ V(Preserve3DWith3DDescendants) \
V(IsolateCompositedDescendants) \ V(IsolateCompositedDescendants) \
V(FullscreenVideoWithCompositedDescendants) \
\ \
/* The root layer is a special case. It may be forced to be a layer, but it \ /* The root layer is a special case. It may be forced to be a layer, but it \
also needs to be a layer if anything else in the subtree is composited. */ \ also needs to be a layer if anything else in the subtree is composited. */ \
......
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