Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(943)

Unified Diff: Source/core/html/HTMLMediaElement.cpp

Issue 59233014: Setting HTMLMediaElement.controller does not properly remove the 'mediagroup' content attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 8402ac95f43129d136bc87f19f493f4cb18fb99d..0f9a7b31818b94aeb19e2b0db77fb2d3905f679b 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -3738,7 +3738,7 @@ void HTMLMediaElement::setMediaGroup(const String& group)
// attribute is set, changed, or removed, the user agent must run the following steps:
// 1. Let m [this] be the media element in question.
// 2. Let m have no current media controller, if it currently has one.
- setController(0);
+ setControllerInternal(0);
// 3. If m's mediagroup attribute is being removed, then abort these steps.
if (group.isNull() || group.isEmpty())
@@ -3755,13 +3755,13 @@ void HTMLMediaElement::setMediaGroup(const String& group)
// the new value of m's mediagroup attribute,
if ((*i)->mediaGroup() == group) {
// then let controller be that media element's current media controller.
- setController((*i)->controller());
+ setControllerInternal((*i)->controller());
return;
}
}
// Otherwise, let controller be a newly created MediaController.
- setController(MediaController::create(Node::executionContext()));
+ setControllerInternal(MediaController::create(Node::executionContext()));
}
MediaController* HTMLMediaElement::controller() const
@@ -3771,6 +3771,15 @@ MediaController* HTMLMediaElement::controller() const
void HTMLMediaElement::setController(PassRefPtr<MediaController> controller)
{
+ // 4.8.10.11.2 Media controllers: controller attribute.
+ // On setting, it must first remove the element's mediagroup attribute, if any,
+ setMediaGroup(String());
philipj_slow 2013/11/08 07:00:17 I think removeAttribute(mediagroupAttr) and lettin
Inactive 2013/11/08 15:35:38 I did the same thing as the previous custom bindin
Inactive 2013/11/08 17:08:31 Congratulations, you found a bug in the custom bin
+ // and then set the current media controller to the given value.
+ setControllerInternal(controller);
+}
+
+void HTMLMediaElement::setControllerInternal(PassRefPtr<MediaController> controller)
+{
if (m_mediaController)
m_mediaController->removeMediaElement(this);

Powered by Google App Engine
This is Rietveld 408576698