Skip to content

Commit

Permalink
Prevent unloaded video sizing issues on MediaDocument
Browse files Browse the repository at this point in the history
This CL removes a unneeded check in layout_video.cc which reduces the
intrinsic height of a video to 1px on MediaDocument.

Bug: 826059
Change-Id: I539f355d4b46de7efbe183195dc506b60e14e523
Reviewed-on: https://chromium-review.googlesource.com/1005508
Reviewed-by: Kent Tamura <tkent@chromium.org>
Reviewed-by: Mounir Lamouri <mlamouri@chromium.org>
Commit-Queue: Tommy Steimel <steimel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551909}
  • Loading branch information
steimelchrome authored and Commit Bot committed Apr 19, 2018
1 parent 10d21d2 commit 77c104a
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 50 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@ layer at (8,44) size 384x334
layer at (0,0) size 380x330
LayoutBlockFlow {HTML} at (0,0) size 380x330
LayoutBlockFlow {BODY} at (8,8) size 364x314 [bgcolor=#000000]
layer at (40,165) size 300x1
LayoutVideo (positioned) {VIDEO} at (40,164.50) size 300x1
layer at (40,165) size 300x54
LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 300x54
layer at (40,165) size 300x54
LayoutFlexibleBox {DIV} at (0,0) size 300x54 [bgcolor=#F1F3F4]
layer at (40,165) size 300x54 scrollHeight 55
layer at (40,90) size 300x150
LayoutVideo (positioned) {VIDEO} at (40,90) size 300x150
layer at (40,90) size 300x150
LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 300x150
layer at (40,138) size 300x54
LayoutFlexibleBox {DIV} at (0,96) size 300x54 [bgcolor=#F1F3F4]
layer at (40,138) size 300x54 scrollHeight 55
LayoutFlexibleBox {DIV} at (0,0) size 300x54
LayoutButton {INPUT} at (10,11) size 32x32
LayoutSlider {INPUT} at (115,-1) size 143x56 [color=#9D968E]
LayoutFlexibleBox {DIV} at (16,26) size 111x4
LayoutButton {INPUT} at (258,11) size 32x32
layer at (87,184) size 28x16 transparent
layer at (87,157) size 28x16 transparent
LayoutBlockFlow {DIV} at (47,19) size 28x16
LayoutText {#text} at (0,0) size 28x16
text run at (0,0) width 28: "0:00"
layer at (119,184) size 36x16 transparent
layer at (119,157) size 36x16 transparent
LayoutBlockFlow {DIV} at (79,19) size 36x16
LayoutText {#text} at (0,0) size 36x16
text run at (0,0) width 36: "/ 0:01"
layer at (171,190) size 111x4
layer at (171,163) size 111x4
LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 111x4 [bgcolor=#00000033]
layer at (220,186) size 12x12
layer at (220,159) size 12x12
LayoutBlockFlow (relative positioned) {DIV} at (49.48,-4) size 12x12 [bgcolor=#000000DE]
layer at (171,190) size 111x4
layer at (171,163) size 111x4
LayoutBlockFlow (positioned) {DIV} at (0,0) size 111x4
layer at (171,190) size 55x4
layer at (171,163) size 55x4
LayoutBlockFlow (positioned) {DIV} at (0,0) size 55x4 [bgcolor=#000000DE]
layer at (226,190) size 55x4
layer at (226,163) size 55x4
LayoutBlockFlow (positioned) {DIV} at (55,0) size 55x4 [bgcolor=#0000008A]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@ layer at (8,42) size 384x334
layer at (0,0) size 380x330
LayoutBlockFlow {HTML} at (0,0) size 380x330
LayoutBlockFlow {BODY} at (8,8) size 364x314 [bgcolor=#000000]
layer at (40,165) size 300x1
LayoutVideo (positioned) {VIDEO} at (40,164.50) size 300x1
layer at (40,165) size 300x54
LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 300x54
layer at (40,165) size 300x54
LayoutFlexibleBox {DIV} at (0,0) size 300x54 [bgcolor=#F1F3F4]
layer at (40,165) size 300x54 scrollHeight 55
layer at (40,90) size 300x150
LayoutVideo (positioned) {VIDEO} at (40,90) size 300x150
layer at (40,90) size 300x150
LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 300x150
layer at (40,138) size 300x54
LayoutFlexibleBox {DIV} at (0,96) size 300x54 [bgcolor=#F1F3F4]
layer at (40,138) size 300x54 scrollHeight 55
LayoutFlexibleBox {DIV} at (0,0) size 300x54
LayoutButton {INPUT} at (10,11) size 32x32
LayoutSlider {INPUT} at (113.28,-1) size 144.72x56 [color=#909090]
LayoutFlexibleBox {DIV} at (16,26) size 112.72x4
LayoutButton {INPUT} at (258,11) size 32x32
layer at (87,184) size 27x16 transparent
layer at (87,157) size 27x16 transparent
LayoutBlockFlow {DIV} at (47,19) size 27.25x16
LayoutText {#text} at (0,0) size 28x16
text run at (0,0) width 28: "0:00"
layer at (118,184) size 35x16 transparent
layer at (118,157) size 35x16 transparent
LayoutBlockFlow {DIV} at (78.25,19) size 35.03x16
LayoutText {#text} at (0,0) size 36x16
text run at (0,0) width 36: "/ 0:01"
layer at (169,190) size 113x4
layer at (169,163) size 113x4
LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 112.72x4 [bgcolor=#00000033]
layer at (220,186) size 12x12
layer at (220,159) size 12x12
LayoutBlockFlow (relative positioned) {DIV} at (50.34,-4) size 12x12 [bgcolor=#000000DE]
layer at (169,190) size 113x4
layer at (169,163) size 113x4
LayoutBlockFlow (positioned) {DIV} at (0,0) size 112.72x4
layer at (169,190) size 56x4
layer at (169,163) size 56x4
LayoutBlockFlow (positioned) {DIV} at (0,0) size 56x4 [bgcolor=#000000DE]
layer at (225,190) size 56x4
layer at (225,163) size 56x4
LayoutBlockFlow (positioned) {DIV} at (56,0) size 56x4 [bgcolor=#0000008A]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@ layer at (8,44) size 384x334
layer at (0,0) size 380x330
LayoutBlockFlow {HTML} at (0,0) size 380x330
LayoutBlockFlow {BODY} at (8,8) size 364x314 [bgcolor=#000000]
layer at (40,165) size 300x1
LayoutVideo (positioned) {VIDEO} at (40,164.50) size 300x1
layer at (40,165) size 300x54
LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 300x54
layer at (40,165) size 300x54
LayoutFlexibleBox {DIV} at (0,0) size 300x54 [bgcolor=#F1F3F4]
layer at (40,165) size 300x54 scrollHeight 55
layer at (40,90) size 300x150
LayoutVideo (positioned) {VIDEO} at (40,90) size 300x150
layer at (40,90) size 300x150
LayoutFlexibleBox (relative positioned) {DIV} at (0,0) size 300x150
layer at (40,138) size 300x54
LayoutFlexibleBox {DIV} at (0,96) size 300x54 [bgcolor=#F1F3F4]
layer at (40,138) size 300x54 scrollHeight 55
LayoutFlexibleBox {DIV} at (0,0) size 300x54
LayoutButton {INPUT} at (10,11) size 32x32
LayoutSlider {INPUT} at (115,-1) size 143x56 [color=#C4C4C4]
LayoutFlexibleBox {DIV} at (16,26) size 111x4
LayoutButton {INPUT} at (258,11) size 32x32
layer at (87,184) size 28x16 transparent
layer at (87,157) size 28x16 transparent
LayoutBlockFlow {DIV} at (47,19) size 28x16
LayoutText {#text} at (0,0) size 28x16
text run at (0,0) width 28: "0:00"
layer at (119,184) size 36x16 transparent
layer at (119,157) size 36x16 transparent
LayoutBlockFlow {DIV} at (79,19) size 36x16
LayoutText {#text} at (0,0) size 36x16
text run at (0,0) width 36: "/ 0:01"
layer at (171,190) size 111x4
layer at (171,163) size 111x4
LayoutBlockFlow (relative positioned) {DIV} at (0,0) size 111x4 [bgcolor=#00000033]
layer at (220,186) size 12x12
layer at (220,159) size 12x12
LayoutBlockFlow (relative positioned) {DIV} at (49.48,-4) size 12x12 [bgcolor=#000000DE]
layer at (171,190) size 111x4
layer at (171,163) size 111x4
LayoutBlockFlow (positioned) {DIV} at (0,0) size 111x4
layer at (171,190) size 55x4
layer at (171,163) size 55x4
LayoutBlockFlow (positioned) {DIV} at (0,0) size 55x4 [bgcolor=#000000DE]
layer at (226,190) size 55x4
layer at (226,163) size 55x4
LayoutBlockFlow (positioned) {DIV} at (55,0) size 55x4 [bgcolor=#0000008A]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 0 additions & 8 deletions third_party/blink/renderer/core/layout/layout_video.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,6 @@ LayoutSize LayoutVideo::CalculateIntrinsicSize() {
!ImageResource()->ErrorOccurred())
return cached_image_size_;

// <video> in standalone media documents should not use the default 300x150
// size since they also have audio-only files. By setting the intrinsic
// size to 300x1 the video will resize itself in these cases, and audio will
// have the correct height (it needs to be > 0 for controls to layout
// properly).
if (video->ownerDocument() && video->ownerDocument()->IsMediaDocument())
return LayoutSize(DefaultSize().Width(), LayoutUnit(1));

return DefaultSize();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ video:-webkit-full-page-media {
max-width: 100%;
}

/**
* The audio controls have a height of 54px, but the video tag has an intrinsic
* height of 150px. To center a 54px within a 150px box, shift up by
* ((150-54)/2) = 48px.
*/
video:-webkit-full-page-media::-webkit-media-controls.audio-only {
transform: translateY(-48px);
}

/**
* Panel Structure
*/
Expand Down

0 comments on commit 77c104a

Please sign in to comment.