Chromium Code Reviews| Index: Source/core/html/HTMLMediaElement.cpp |
| diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp |
| index 8402ac95f43129d136bc87f19f493f4cb18fb99d..869f8ad74ac62394791077f987c88e190442efc6 100644 |
| --- a/Source/core/html/HTMLMediaElement.cpp |
| +++ b/Source/core/html/HTMLMediaElement.cpp |
| @@ -3723,22 +3723,18 @@ AudioSourceProvider* HTMLMediaElement::audioSourceProvider() |
| } |
| #endif |
| -const String& HTMLMediaElement::mediaGroup() const |
| +const AtomicString& HTMLMediaElement::mediaGroup() const |
| { |
| - return m_mediaGroup; |
| + return fastGetAttribute(HTMLNames::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()) |
| @@ -3755,13 +3751,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 +3767,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(HTMLNames::mediagroupAttr); |
|
philipj_slow
2013/11/08 19:58:04
Is the HTMLNames:: prefix needed? The vast majorit
Inactive
2013/11/08 20:12:06
Done.
|
| + // 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); |