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); |