Commit 0631e18f authored by Becca Hughes's avatar Becca Hughes Committed by Commit Bot

Media Controls: Remove manual paint invalidation

The media controls were performing manual paint invalidation
from when we used to have MediaControlPainter. Now we use
CSS this is handled for us automatically.

According to manual testing this reduces the time painting
from 153 ms to 49ms.

BUG=821961,821414

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_layout_ng
Change-Id: Ie864f914c7ced0031710d81a7a702c8e3697a312
Reviewed-on: https://chromium-review.googlesource.com/998834
Commit-Queue: Becca Hughes <beccahughes@chromium.org>
Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548832}
parent 4cb700f0
......@@ -2029,8 +2029,6 @@ crbug.com/591099 paint/invalidation/vertical-align-length2.html [ Failure ]
crbug.com/591099 paint/invalidation/vertical-align1.html [ Failure ]
crbug.com/591099 paint/invalidation/vertical-align2.html [ Failure ]
crbug.com/591099 paint/invalidation/vertical-rl-as-paint-container.html [ Failure ]
crbug.com/591099 paint/invalidation/video-mute-repaint.html [ Failure ]
crbug.com/591099 paint/invalidation/video-unmute-repaint.html [ Failure ]
crbug.com/591099 paint/invalidation/window-resize/window-resize-centered-inline-under-fixed-pos.html [ Failure ]
crbug.com/591099 paint/invalidation/window-resize/window-resize-vertical-writing-mode.html [ Failure ]
crbug.com/591099 paint/markers/active-suggestion-marker-basic.html [ Failure ]
......
......@@ -732,8 +732,6 @@ Bug(none) paint/invalidation/repaint-overlay/layers.html [ Failure ]
Bug(none) paint/invalidation/svg/deep-nested-embedded-svg-size-changes-no-layout-triggers-1.html [ Failure ]
Bug(none) paint/invalidation/svg/deep-nested-embedded-svg-size-changes-no-layout-triggers-2.html [ Failure ]
Bug(none) paint/invalidation/svg/animated-svg-as-image-transformed-offscreen.html [ Failure ]
Bug(none) paint/invalidation/video-mute-repaint.html [ Failure ]
Bug(none) paint/invalidation/video-unmute-repaint.html [ Failure ]
Bug(none) paint/invalidation/window-resize/window-resize-vertical-writing-mode.html [ Failure ]
# Wrong invalidation/painting/rasterization for multicol. Different layer tree.
......
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"drawsContent": false,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling Layer",
"bounds": [800, 600],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutVideo VIDEO id='v'",
"position": [8, 8],
"bounds": [700, 525],
"drawsContent": false
},
{
"name": "Squashing Containment Layer",
"drawsContent": false
},
{
"name": "LayoutFlexibleBox (relative positioned) DIV class='phase-ready state-stopped'",
"position": [8, 8],
"bounds": [700, 525]
},
{
"name": "Squashing Layer (first squashed layer: LayoutFlexibleBox (relative positioned) DIV)",
"position": [8, 8],
"bounds": [700, 525],
"paintInvalidations": [
{
"object": "LayoutBlockFlow (positioned) DIV",
"rect": [580, 508, 70, 2],
"reason": "disappeared"
},
{
"object": "LayoutBlockFlow (positioned) DIV id='thumb'",
"rect": [632, 493, 36, 32],
"reason": "full"
},
{
"object": "LayoutBlockFlow (positioned) DIV id='thumb'",
"rect": [562, 493, 36, 32],
"reason": "full"
},
{
"object": "LayoutButton INPUT class='muted'",
"rect": [530, 493, 32, 32],
"reason": "full"
}
]
}
],
"objectPaintInvalidations": [
{
"object": "LayoutVideo VIDEO id='v'",
"reason": "style change"
},
{
"object": "LayoutFlexibleBox (relative positioned) DIV class='phase-ready state-stopped'",
"reason": "geometry"
},
{
"object": "LayoutButton INPUT class='muted'",
"reason": "full"
},
{
"object": "LayoutFlexibleBox DIV",
"reason": "geometry"
},
{
"object": "LayoutBlockFlow (positioned) DIV id='thumb'",
"reason": "full"
},
{
"object": "LayoutBlockFlow (positioned) DIV",
"reason": "disappeared"
}
]
}
<!DOCTYPE html>
<title>Test for crbug.com/190880</title>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<script src="resources/text-based-repaint.js"></script>
<style>
video { width: 700px; }
</style>
<video id="v" controls autoload src="../../media/content/test.ogv">
</video>
<script>
window.testIsAsync = true;
var video = document.getElementById("v");
video.addEventListener("canplaythrough", runRepaintTest, true);
function repaintTest() {
video.volume = 0;
// Volume change is handled in another document cycle.
runAfterLayoutAndPaint(finishRepaintTest);
}
</script>
{
"layers": [
{
"name": "LayoutView #document",
"bounds": [800, 600],
"drawsContent": false,
"backgroundColor": "#FFFFFF"
},
{
"name": "Scrolling Layer",
"bounds": [800, 600],
"drawsContent": false
},
{
"name": "Scrolling Contents Layer",
"bounds": [800, 600],
"contentsOpaque": true,
"backgroundColor": "#FFFFFF"
},
{
"name": "LayoutVideo VIDEO id='v'",
"position": [8, 8],
"bounds": [700, 525],
"drawsContent": false
},
{
"name": "Squashing Containment Layer",
"drawsContent": false
},
{
"name": "LayoutFlexibleBox (relative positioned) DIV class='phase-ready state-stopped'",
"position": [8, 8],
"bounds": [700, 525]
},
{
"name": "Squashing Layer (first squashed layer: LayoutFlexibleBox (relative positioned) DIV)",
"position": [8, 8],
"bounds": [700, 525],
"paintInvalidations": [
{
"object": "LayoutBlockFlow (positioned) DIV id='thumb'",
"rect": [597, 493, 36, 32],
"reason": "full"
},
{
"object": "LayoutBlockFlow (positioned) DIV id='thumb'",
"rect": [562, 493, 36, 32],
"reason": "full"
},
{
"object": "LayoutBlockFlow (positioned) DIV",
"rect": [580, 508, 35, 2],
"reason": "appeared"
},
{
"object": "LayoutButton INPUT",
"rect": [530, 493, 32, 32],
"reason": "full"
}
]
}
],
"objectPaintInvalidations": [
{
"object": "LayoutVideo VIDEO id='v'",
"reason": "style change"
},
{
"object": "LayoutFlexibleBox (relative positioned) DIV class='phase-ready state-stopped'",
"reason": "geometry"
},
{
"object": "LayoutButton INPUT",
"reason": "full"
},
{
"object": "LayoutFlexibleBox DIV",
"reason": "geometry"
},
{
"object": "LayoutBlockFlow (positioned) DIV id='thumb'",
"reason": "full"
},
{
"object": "LayoutBlockFlow (positioned) DIV",
"reason": "appeared"
}
]
}
<!DOCTYPE html>
<title>Test for crbug.com/190880</title>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<script src="resources/text-based-repaint.js"></script>
<style>
video { width: 700px; }
</style>
<video id="v" controls autoload src="../../media/content/test.ogv">
</video>
<p>This tests that we repaint the mute button when we change the volume</p>
<script>
window.testIsAsync = true;
var video = document.getElementById("v");
video.addEventListener("canplaythrough", runTest, true);
function repaintTest() {
video.volume = 0.5;
// Volume change is handled in another document cycle.
runAfterLayoutAndPaint(finishRepaintTest);
}
function runTest() {
video.volume = 0;
runRepaintTest();
}
</script>
......@@ -1796,25 +1796,7 @@ bool MediaControlsImpl::ShouldShowDisabledControls() const {
!is_acting_as_audio_controls_;
}
void MediaControlsImpl::Invalidate(Element* element) {
if (!element)
return;
if (LayoutObject* layout_object = element->GetLayoutObject()) {
layout_object
->SetShouldDoFullPaintInvalidationIncludingNonCompositingDescendants();
}
}
void MediaControlsImpl::NetworkStateChanged() {
Invalidate(play_button_);
Invalidate(overlay_play_button_);
Invalidate(mute_button_);
Invalidate(fullscreen_button_);
Invalidate(download_button_);
Invalidate(timeline_);
Invalidate(volume_slider_);
// Update the display state of the download button in case we now have a
// source or no longer have a source.
download_button_->SetIsWanted(
......
......@@ -204,8 +204,6 @@ class MODULES_EXPORT MediaControlsImpl final : public HTMLDivElement,
class MediaControlsResizeObserverDelegate;
class MediaElementMutationCallback;
void Invalidate(Element*);
// Notify us that our controls enclosure has changed size.
void NotifyElementSizeChanged(DOMRectReadOnly* new_size);
......
......@@ -5,7 +5,6 @@
#include "modules/media_controls/elements/MediaControlElementBase.h"
#include "core/html/media/HTMLMediaElement.h"
#include "core/layout/LayoutObject.h"
#include "modules/media_controls/MediaControlsImpl.h"
namespace blink {
......@@ -67,12 +66,7 @@ HTMLMediaElement& MediaControlElementBase::MediaElement() const {
void MediaControlElementBase::SetDisplayType(
MediaControlElementType display_type) {
if (display_type == display_type_)
return;
display_type_ = display_type;
if (LayoutObject* object = element_->GetLayoutObject())
object->SetShouldDoFullPaintInvalidation();
}
void MediaControlElementBase::Trace(blink::Visitor* visitor) {
......
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