Commit 59582113 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Chromium LUCI CQ

Move non-control media styling to html.css

Moved two rules styling the media element, and not its controls, into
html.css. Also add a html default @namespace to the media controls
sheet to avoid any unintended effects outside of html.

Bug: 1166678
Change-Id: Ib1ac69f12f52700fc408d81a4655f55c18b4da89
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2629927Reviewed-by: default avatarTommy Steimel <steimel@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844907}
parent f70fea14
......@@ -4016,4 +4016,26 @@ TEST_F(StyleEngineTest, RejectSlottedSelector) {
EXPECT_EQ(1u, stats->rules_fast_rejected);
}
TEST_F(StyleEngineTest, AudioUAStyleNameSpace) {
GetDocument().body()->setInnerHTML(R"HTML(
<audio id="html-audio"></audio>
)HTML");
Element* html_audio = GetDocument().getElementById("html-audio");
Element* audio = GetDocument().createElementNS("http://dummyns", "audio",
ASSERT_NO_EXCEPTION);
GetDocument().body()->appendChild(audio);
UpdateAllLifecyclePhases();
// display:none UA rule for audio element should not apply outside html.
EXPECT_TRUE(audio->GetComputedStyle());
EXPECT_FALSE(html_audio->GetComputedStyle());
FloatSize page_size(400, 400);
GetDocument().GetFrame()->StartPrinting(page_size, page_size, 1);
// Also for printing.
EXPECT_TRUE(audio->GetComputedStyle());
EXPECT_FALSE(html_audio->GetComputedStyle());
}
} // namespace blink
......@@ -150,6 +150,32 @@ video {
object-fit: contain;
}
video:-webkit-full-page-media {
margin: auto;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
max-height: 100%;
max-width: 100%;
}
audio:not([controls]) {
display: none !important;
}
/** TODO(crbug.com/985623): Remove these hard-coded audio tag size.
* This fixed audio tag width/height leads to fail the wpt tests below.
* crbug.com/955170 external/wpt/css/css-contain/contain-size-replaced-003a.html
* crbug.com/955163 external/wpt/css/css-contain/contain-size-replaced-003b.html
* crbug.com/955163 external/wpt/css/css-contain/contain-size-replaced-003c.html
*/
audio {
width: 300px;
height: 54px;
}
/* heading elements */
h1 {
......
......@@ -2,21 +2,7 @@
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.*/
/**
* Used in MediaDocument only.
* TODO: Move those outside of this file.
*/
video:-webkit-full-page-media {
margin: auto;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
max-height: 100%;
max-width: 100%;
}
@namespace "http://www.w3.org/1999/xhtml";
/**
* Panel Structure
......@@ -1072,21 +1058,6 @@ video::-webkit-media-controls-overlay-enclosure {
* Audio Controls
*/
audio:not([controls]) {
display: none !important;
}
/** TODO(crbug.com/985623): Remove these hard-coded audio tag size.
* This fixed audio tag width/height leads to fail the wpt tests below.
* crbug.com/955170 external/wpt/css/css-contain/contain-size-replaced-003a.html
* crbug.com/955163 external/wpt/css/css-contain/contain-size-replaced-003b.html
* crbug.com/955163 external/wpt/css/css-contain/contain-size-replaced-003c.html
*/
audio {
width: 300px;
height: 54px;
}
audio::-webkit-media-controls-overlay-enclosure,
video::-webkit-media-controls.audio-only [pseudo="-webkit-media-controls-overlay-enclosure"] {
display: none;
......
......@@ -2,6 +2,7 @@
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.*/
@namespace "http://www.w3.org/1999/xhtml";
/* On Android, we always want the slider thumb to appear. */
video::-webkit-media-controls input[pseudo="-webkit-media-controls-timeline" i]::-webkit-slider-thumb,
......
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