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

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: Rebase on master 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
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/core/html/HTMLMediaElement.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 113582a4983cf06f4aae571acc0da01ef3fe46e5..7d098fa09248baa5dc3cfecdecbed0e580d86a2c 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -3722,22 +3722,18 @@ AudioSourceProvider* HTMLMediaElement::audioSourceProvider()
}
#endif
-const String& HTMLMediaElement::mediaGroup() const
+const AtomicString& HTMLMediaElement::mediaGroup() const
{
- return m_mediaGroup;
+ return fastGetAttribute(mediagroupAttr);
}
-void HTMLMediaElement::setMediaGroup(const String& group)
+void HTMLMediaElement::setMediaGroup(const AtomicString& group)
{
- if (m_mediaGroup == group)
- return;
- m_mediaGroup = group;
-
// When a media element is created with a mediagroup attribute, and when a media element's mediagroup
// 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())
@@ -3754,13 +3750,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
@@ -3770,6 +3766,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,
+ removeAttribute(mediagroupAttr);
+ // 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);
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/core/html/HTMLMediaElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698