Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 3705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3716 | 3716 |
| 3717 AudioSourceProvider* HTMLMediaElement::audioSourceProvider() | 3717 AudioSourceProvider* HTMLMediaElement::audioSourceProvider() |
| 3718 { | 3718 { |
| 3719 if (m_player) | 3719 if (m_player) |
| 3720 return m_player->audioSourceProvider(); | 3720 return m_player->audioSourceProvider(); |
| 3721 | 3721 |
| 3722 return 0; | 3722 return 0; |
| 3723 } | 3723 } |
| 3724 #endif | 3724 #endif |
| 3725 | 3725 |
| 3726 const String& HTMLMediaElement::mediaGroup() const | 3726 const AtomicString& HTMLMediaElement::mediaGroup() const |
| 3727 { | 3727 { |
| 3728 return m_mediaGroup; | 3728 return fastGetAttribute(HTMLNames::mediagroupAttr); |
| 3729 } | 3729 } |
| 3730 | 3730 |
| 3731 void HTMLMediaElement::setMediaGroup(const String& group) | 3731 void HTMLMediaElement::setMediaGroup(const AtomicString& group) |
| 3732 { | 3732 { |
| 3733 if (m_mediaGroup == group) | |
| 3734 return; | |
| 3735 m_mediaGroup = group; | |
| 3736 | |
| 3737 // When a media element is created with a mediagroup attribute, and when a m edia element's mediagroup | 3733 // When a media element is created with a mediagroup attribute, and when a m edia element's mediagroup |
| 3738 // attribute is set, changed, or removed, the user agent must run the follow ing steps: | 3734 // attribute is set, changed, or removed, the user agent must run the follow ing steps: |
| 3739 // 1. Let m [this] be the media element in question. | 3735 // 1. Let m [this] be the media element in question. |
| 3740 // 2. Let m have no current media controller, if it currently has one. | 3736 // 2. Let m have no current media controller, if it currently has one. |
| 3741 setController(0); | 3737 setControllerInternal(0); |
| 3742 | 3738 |
| 3743 // 3. If m's mediagroup attribute is being removed, then abort these steps. | 3739 // 3. If m's mediagroup attribute is being removed, then abort these steps. |
| 3744 if (group.isNull() || group.isEmpty()) | 3740 if (group.isNull() || group.isEmpty()) |
| 3745 return; | 3741 return; |
| 3746 | 3742 |
| 3747 // 4. If there is another media element whose Document is the same as m's Do cument (even if one or both | 3743 // 4. If there is another media element whose Document is the same as m's Do cument (even if one or both |
| 3748 // of these elements are not actually in the Document), | 3744 // of these elements are not actually in the Document), |
| 3749 HashSet<HTMLMediaElement*> elements = documentToElementSetMap().get(&documen t()); | 3745 HashSet<HTMLMediaElement*> elements = documentToElementSetMap().get(&documen t()); |
| 3750 for (HashSet<HTMLMediaElement*>::iterator i = elements.begin(); i != element s.end(); ++i) { | 3746 for (HashSet<HTMLMediaElement*>::iterator i = elements.begin(); i != element s.end(); ++i) { |
| 3751 if (*i == this) | 3747 if (*i == this) |
| 3752 continue; | 3748 continue; |
| 3753 | 3749 |
| 3754 // and which also has a mediagroup attribute, and whose mediagroup attri bute has the same value as | 3750 // and which also has a mediagroup attribute, and whose mediagroup attri bute has the same value as |
| 3755 // the new value of m's mediagroup attribute, | 3751 // the new value of m's mediagroup attribute, |
| 3756 if ((*i)->mediaGroup() == group) { | 3752 if ((*i)->mediaGroup() == group) { |
| 3757 // then let controller be that media element's current media contro ller. | 3753 // then let controller be that media element's current media contro ller. |
| 3758 setController((*i)->controller()); | 3754 setControllerInternal((*i)->controller()); |
| 3759 return; | 3755 return; |
| 3760 } | 3756 } |
| 3761 } | 3757 } |
| 3762 | 3758 |
| 3763 // Otherwise, let controller be a newly created MediaController. | 3759 // Otherwise, let controller be a newly created MediaController. |
| 3764 setController(MediaController::create(Node::executionContext())); | 3760 setControllerInternal(MediaController::create(Node::executionContext())); |
| 3765 } | 3761 } |
| 3766 | 3762 |
| 3767 MediaController* HTMLMediaElement::controller() const | 3763 MediaController* HTMLMediaElement::controller() const |
| 3768 { | 3764 { |
| 3769 return m_mediaController.get(); | 3765 return m_mediaController.get(); |
| 3770 } | 3766 } |
| 3771 | 3767 |
| 3772 void HTMLMediaElement::setController(PassRefPtr<MediaController> controller) | 3768 void HTMLMediaElement::setController(PassRefPtr<MediaController> controller) |
| 3773 { | 3769 { |
| 3770 // 4.8.10.11.2 Media controllers: controller attribute. | |
| 3771 // On setting, it must first remove the element's mediagroup attribute, if a ny, | |
| 3772 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.
| |
| 3773 // and then set the current media controller to the given value. | |
| 3774 setControllerInternal(controller); | |
| 3775 } | |
| 3776 | |
| 3777 void HTMLMediaElement::setControllerInternal(PassRefPtr<MediaController> control ler) | |
| 3778 { | |
| 3774 if (m_mediaController) | 3779 if (m_mediaController) |
| 3775 m_mediaController->removeMediaElement(this); | 3780 m_mediaController->removeMediaElement(this); |
| 3776 | 3781 |
| 3777 m_mediaController = controller; | 3782 m_mediaController = controller; |
| 3778 | 3783 |
| 3779 if (m_mediaController) | 3784 if (m_mediaController) |
| 3780 m_mediaController->addMediaElement(this); | 3785 m_mediaController->addMediaElement(this); |
| 3781 | 3786 |
| 3782 if (hasMediaControls()) | 3787 if (hasMediaControls()) |
| 3783 mediaControls()->setMediaController(m_mediaController ? m_mediaControlle r.get() : static_cast<MediaControllerInterface*>(this)); | 3788 mediaControls()->setMediaController(m_mediaController ? m_mediaControlle r.get() : static_cast<MediaControllerInterface*>(this)); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3871 { | 3876 { |
| 3872 scheduleLayerUpdate(); | 3877 scheduleLayerUpdate(); |
| 3873 } | 3878 } |
| 3874 | 3879 |
| 3875 bool HTMLMediaElement::isInteractiveContent() const | 3880 bool HTMLMediaElement::isInteractiveContent() const |
| 3876 { | 3881 { |
| 3877 return fastHasAttribute(controlsAttr); | 3882 return fastHasAttribute(controlsAttr); |
| 3878 } | 3883 } |
| 3879 | 3884 |
| 3880 } | 3885 } |
| OLD | NEW |