Commit 741c2663 authored by Mounir Lamouri's avatar Mounir Lamouri Committed by Commit Bot

HTMLMediaElement: follow spec with regards to muted attribute.

Setting the internal muted state based on the muted content attribute
when the attributes have been parsed instead of waiting for the children
to be parsed. This allows edge cases such as checking for `muted` in a
<script> inside the element to return the correct value.

This is fixing all the HTML tests for the muted attribute that Blink
used to fail.

Bug: 350303
Change-Id: I51c00abdf40b36d2222ddca2be69d61a0286f657
Reviewed-on: https://chromium-review.googlesource.com/819555
Commit-Queue: Philip Jägenstedt <foolip@chromium.org>
Reviewed-by: default avatarPhilip Jägenstedt <foolip@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523388}
parent 54ea01fa
This is a testharness.js-based test.
PASS getting audio.muted (parser-created)
PASS setting audio.muted (parser-created)
FAIL getting audio.muted with muted="" (parser-created) assert_true: expected true got false
FAIL setting audio.muted with muted="" (parser-created) assert_equals: expected true but got false
PASS getting video.muted (parser-created)
PASS setting video.muted (parser-created)
FAIL getting video.muted with muted="" (parser-created) assert_true: expected true got false
FAIL setting video.muted with muted="" (parser-created) assert_equals: expected true but got false
PASS getting video.muted with muted="" after load (parser-created)
PASS getting audio.muted (script-created)
PASS setting audio.muted (script-created)
PASS getting audio.muted with muted="" (script-created)
PASS setting audio.muted with muted="" (script-created)
PASS getting audio.muted with muted="" (innerHTML-created)
FAIL getting audio.muted with muted="" (document.write-created) assert_true: expected true got false
PASS getting video.muted (script-created)
PASS setting video.muted (script-created)
PASS getting video.muted with muted="" (script-created)
PASS setting video.muted with muted="" (script-created)
PASS getting video.muted with muted="" (innerHTML-created)
FAIL getting video.muted with muted="" (document.write-created) assert_true: expected true got false
Harness: the test ran to completion.
......@@ -650,11 +650,15 @@ void HTMLMediaElement::ParseAttribute(
}
}
void HTMLMediaElement::FinishParsingChildren() {
HTMLElement::FinishParsingChildren();
void HTMLMediaElement::ParserDidSetAttributes() {
HTMLElement::ParserDidSetAttributes();
if (FastHasAttribute(mutedAttr))
muted_ = true;
}
void HTMLMediaElement::FinishParsingChildren() {
HTMLElement::FinishParsingChildren();
if (Traversal<HTMLTrackElement>::FirstChild(*this))
ScheduleTextTrackResourceLoad();
......
......@@ -336,6 +336,7 @@ class CORE_EXPORT HTMLMediaElement
void FinishParsingChildren() final;
bool IsURLAttribute(const Attribute&) const override;
void AttachLayoutTree(AttachContext&) override;
void ParserDidSetAttributes() override;
InsertionNotificationRequest InsertedInto(ContainerNode*) override;
void RemovedFrom(ContainerNode*) override;
......
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