forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove lifecycle updates for preferred content size changes
On platforms that need preferred content size updates (MacOS and Android), an additional blink lifecycle update is issued if layout changes because ContentsPreferredMinimumSize is called after layout. In most cases this is unnecessary because layout is already up-to-date. On platforms that use PreferredSizeChangedMode (e.g, MacOS), the preferred size is updated after layout (RVI::DidUpdateMainFrameLayout) and when the PreferredSizeChangedMode setting is enabled. When called from DidUpdateMainFrameLayout, no lifecycle update is needed. When the setting is first enabled, this patch now explicitly updates the lifecycle before updating the preferred size. On Android (AwRenderViewExt), the preferred size update does not appear to need to force a lifecycle update because the common path in AwRenderViewExt::UpdateContentsSize uses DocumentSize which does not force a layout update. This patch removes the forced lifecycle update from ContentsPreferredMinimumSize and adds a DCHECK that is is only called with up-to-date layout. An integration test has been added that ensures no extra lifecycle updates occur. This would have caught https://crbug.com/866981. This patch changes the expectations for media/video-zoom-controls.html which was different on MacOS compared to Windows and Linux. The media controls code is racy with layout and will put up a bad frame (see: MediaControlsImpl::NotifyElementSizeChanged). Before this patch, the preferred content size layout timer would occur before the media controls layout timer and cause different controls to show up on MacOS. With this patch, the expectation on MacOS now matches other platforms. Bug: 868983 Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng Change-Id: I80098edd844bb88e3c64a54cc42b54063ec1c583 Reviewed-on: https://chromium-review.googlesource.com/1153972 Reviewed-by: Philip Rogers <pdr@chromium.org> Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Reviewed-by: Bo <boliu@chromium.org> Reviewed-by: Antoine Labour <piman@chromium.org> Commit-Queue: Philip Rogers <pdr@chromium.org> Cr-Commit-Position: refs/heads/master@{#581383}
- Loading branch information
Showing
32 changed files
with
263 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
third_party/WebKit/LayoutTests/lifecycle/background-change-lifecycle-count.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<!doctype html> | ||
<script src="../resources/testharness.js"></script> | ||
<script src="../resources/testharnessreport.js"></script> | ||
|
||
<div id="box" style="width: 100px; height: 100px; background: blue;"></div> | ||
|
||
<script> | ||
var t = async_test('Integration test for background style change updates'); | ||
|
||
t.step(function() { | ||
assert_true(!!window.internals, 'Test requires window.internals'); | ||
}); | ||
|
||
// Loading is non-deterministic so record the initial count after onload | ||
// plus a paint. | ||
onload = function() { | ||
requestAnimationFrame(function() { | ||
// Windows flakily sends mouse events on the first frame so wait an | ||
// additional frame before starting the test. | ||
requestAnimationFrame(function() { | ||
var initialLifecycleCount = internals.LifecycleUpdateCount(); | ||
|
||
box.style.background = 'green'; | ||
|
||
requestAnimationFrame(function() { | ||
var postChangeCount = internals.LifecycleUpdateCount(); | ||
t.step(function() { | ||
// A background style change should have only resulted in a single | ||
// lifecycle update. If this ever fails, something is causing an | ||
// unnecessary lifecycle update. | ||
assert_equals(postChangeCount, initialLifecycleCount + 1, | ||
'a style change should cause one lifecycle update'); | ||
}); | ||
|
||
// A timeout is used so we can capture unnecessary updates. 250ms was | ||
// chosen because it is the lowest value that would reliably fail for | ||
// https://crbug.com/866981 and https://crbug.com/868983 on bots; lower | ||
// values would just become flaky. | ||
setTimeout(function() { | ||
t.step(function() { | ||
// The timeout should cause a single additional update. If this ever | ||
// fails, something is causing an unnecessary lifecycle update. | ||
assert_equals(internals.LifecycleUpdateCount(), postChangeCount + 1, | ||
'a timeout should cause one lifecycle update'); | ||
}); | ||
t.done(); | ||
}, 250); | ||
}); | ||
}); | ||
}); | ||
} | ||
</script> |
Binary file modified
BIN
+4.74 KB
(110%)
...WebKit/LayoutTests/platform/mac-mac10.12/media/video-zoom-controls-expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.72 KB
(110%)
...mac-mac10.12/virtual/video-surface-layer/media/video-zoom-controls-expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.73 KB
(110%)
third_party/WebKit/LayoutTests/platform/mac/media/video-zoom-controls-expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+4.72 KB
(110%)
...platform/mac/virtual/video-surface-layer/media/video-zoom-controls-expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 86 additions & 0 deletions
86
...youtTests/platform/mac/virtual/video-surface-layer/media/video-zoom-controls-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
layer at (0,0) size 800x600 | ||
LayoutView at (0,0) size 800x600 | ||
layer at (0,0) size 800x600 | ||
LayoutBlockFlow {HTML} at (0,0) size 800x600 | ||
LayoutBlockFlow {BODY} at (12,12) size 776x543 | ||
LayoutBlockFlow {P} at (0,0) size 776x28 | ||
LayoutText {#text} at (0,0) size 278x28 | ||
text run at (0,0) width 278: "Zoomed video with controls." | ||
layer at (57,85) size 240x180 | ||
LayoutVideo {VIDEO} at (45,73) size 240x180 | ||
layer at (57,85) size 240x180 | ||
LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 240x180 | ||
LayoutFlexibleBox {DIV} at (0,0) size 240x180 | ||
layer at (57,85) size 240x180 | ||
LayoutBlockFlow (positioned) {DIV} at (0,0) size 240x180 | ||
layer at (57,85) size 240x180 | ||
LayoutFlexibleBox {DIV} at (0,0) size 240x180 | ||
layer at (57,85) size 240x156 clip at (59,87) size 237x153 | ||
LayoutButton (relative positioned) {INPUT} at (0,0) size 240x156 [border: (1.50px solid #D8D8D8) (1.50px solid #D1D1D1) (1.50px solid #BABABA) (1.50px solid #D1D1D1)] | ||
LayoutFlexibleBox (anonymous) at (12,41.25) size 216x72 | ||
LayoutBlockFlow {DIV} at (72,0) size 72x72 [bgcolor=#FFFFFFE6] | ||
layer at (57,169) size 240x72 scrollWidth 339 | ||
LayoutFlexibleBox (relative positioned) {DIV} at (0,84) size 240x72 | ||
LayoutBlockFlow {DIV} at (24,0) size 46.72x72 [color=#FFFFFF] | ||
LayoutText {#text} at (0,22) size 47x28 | ||
text run at (0,22) width 47: "0:00" | ||
LayoutBlockFlow {DIV} at (76.72,-72) size 46.72x144 [color=#FFFFFF] | ||
LayoutText {#text} at (0,22) size 47x100 | ||
text run at (0,22) width 7: "/" | ||
text run at (0,94) width 47: "0:06" | ||
LayoutBlockFlow {DIV} at (123.44,72) size 0x0 | ||
LayoutButton {INPUT} at (123.44,0) size 72x72 | ||
LayoutButton {INPUT} at (195.44,0) size 72x72 | ||
LayoutButton {INPUT} at (267.44,0) size 72x72 | ||
layer at (57,241) size 240x24 | ||
LayoutSlider {INPUT} at (0,156) size 240x24 [color=#909090] | ||
LayoutFlexibleBox {DIV} at (24,0) size 192x6 | ||
layer at (81,241) size 192x6 | ||
LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 192x6 [bgcolor=#FFFFFF4D] | ||
layer at (81,235) size 18x18 | ||
LayoutBlockFlow (relative positioned) {DIV} at (0,-6) size 18x18 [bgcolor=#FFFFFF] | ||
layer at (81,241) size 192x6 scrollWidth 288 | ||
LayoutBlockFlow (positioned) {DIV} at (0,0) size 192x6 | ||
layer at (81,241) size 0x6 | ||
LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x6 [bgcolor=#FFFFFF] | ||
layer at (81,241) size 288x6 backgroundClip at (81,241) size 192x6 clip at (81,241) size 192x6 | ||
LayoutBlockFlow (positioned) {DIV} at (0,0) size 288x6 [bgcolor=#FFFFFF8A] | ||
layer at (57,310) size 240x180 | ||
LayoutVideo {VIDEO} at (45,298) size 240x180 | ||
layer at (57,310) size 240x180 | ||
LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 240x180 | ||
LayoutFlexibleBox {DIV} at (0,0) size 240x180 | ||
layer at (57,310) size 240x180 | ||
LayoutBlockFlow (positioned) {DIV} at (0,0) size 240x180 | ||
layer at (57,310) size 240x180 | ||
LayoutFlexibleBox {DIV} at (0,0) size 240x180 | ||
layer at (57,310) size 240x156 clip at (59,312) size 237x153 | ||
LayoutButton (relative positioned) {INPUT} at (0,0) size 240x156 [border: (1.50px solid #D8D8D8) (1.50px solid #D1D1D1) (1.50px solid #BABABA) (1.50px solid #D1D1D1)] | ||
LayoutFlexibleBox (anonymous) at (12,41.25) size 216x72 | ||
LayoutBlockFlow {DIV} at (72,0) size 72x72 [bgcolor=#FFFFFFE6] | ||
layer at (57,394) size 240x72 backgroundClip at (47,373) size 249x113 clip at (57,394) size 239x72 scrollWidth 339 | ||
LayoutFlexibleBox (relative positioned) {DIV} at (0,84) size 240x72 | ||
LayoutBlockFlow {DIV} at (24,0) size 46.72x72 [color=#FFFFFF] | ||
LayoutText {#text} at (0,22) size 47x28 | ||
text run at (0,22) width 47: "0:00" | ||
LayoutBlockFlow {DIV} at (76.72,-72) size 46.72x144 [color=#FFFFFF] | ||
LayoutText {#text} at (0,22) size 47x100 | ||
text run at (0,22) width 7: "/" | ||
text run at (0,94) width 47: "0:06" | ||
LayoutBlockFlow {DIV} at (123.44,72) size 0x0 | ||
LayoutButton {INPUT} at (123.44,0) size 72x72 | ||
LayoutButton {INPUT} at (195.44,0) size 72x72 | ||
LayoutButton {INPUT} at (267.44,0) size 72x72 | ||
layer at (57,466) size 240x24 | ||
LayoutSlider {INPUT} at (0,156) size 240x24 [color=#909090] | ||
LayoutFlexibleBox {DIV} at (24,0) size 192x6 | ||
layer at (81,466) size 192x6 | ||
LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 192x6 [bgcolor=#FFFFFF4D] | ||
layer at (81,460) size 18x18 | ||
LayoutBlockFlow (relative positioned) {DIV} at (0,-6) size 18x18 [bgcolor=#FFFFFF] | ||
layer at (81,466) size 192x6 backgroundClip at (70,448) size 190x40 clip at (81,466) size 179x6 scrollWidth 288 | ||
LayoutBlockFlow (positioned) {DIV} at (0,0) size 192x6 | ||
layer at (81,466) size 0x6 | ||
LayoutBlockFlow (positioned) {DIV} at (0,0) size 0x6 [bgcolor=#FFFFFF] | ||
layer at (81,466) size 288x6 backgroundClip at (70,448) size 190x40 clip at (70,448) size 190x40 | ||
LayoutBlockFlow (positioned) {DIV} at (0,0) size 288x6 [bgcolor=#FFFFFF8A] |
1 change: 1 addition & 0 deletions
1
third_party/WebKit/LayoutTests/virtual/threaded/lifecycle/README.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# This suite runs only the tests in this directory with --enable-threaded-compositing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.