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 3720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3731 void HTMLMediaElement::setMediaGroup(const String& group) | 3731 void HTMLMediaElement::setMediaGroup(const String& group) |
3732 { | 3732 { |
3733 if (m_mediaGroup == group) | 3733 if (m_mediaGroup == group) |
3734 return; | 3734 return; |
3735 m_mediaGroup = group; | 3735 m_mediaGroup = group; |
3736 | 3736 |
3737 // When a media element is created with a mediagroup attribute, and when a m edia element's mediagroup | 3737 // 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: | 3738 // 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. | 3739 // 1. Let m [this] be the media element in question. |
3740 // 2. Let m have no current media controller, if it currently has one. | 3740 // 2. Let m have no current media controller, if it currently has one. |
3741 setController(0); | 3741 setControllerInternal(0); |
3742 | 3742 |
3743 // 3. If m's mediagroup attribute is being removed, then abort these steps. | 3743 // 3. If m's mediagroup attribute is being removed, then abort these steps. |
3744 if (group.isNull() || group.isEmpty()) | 3744 if (group.isNull() || group.isEmpty()) |
3745 return; | 3745 return; |
3746 | 3746 |
3747 // 4. If there is another media element whose Document is the same as m's Do cument (even if one or both | 3747 // 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), | 3748 // of these elements are not actually in the Document), |
3749 HashSet<HTMLMediaElement*> elements = documentToElementSetMap().get(&documen t()); | 3749 HashSet<HTMLMediaElement*> elements = documentToElementSetMap().get(&documen t()); |
3750 for (HashSet<HTMLMediaElement*>::iterator i = elements.begin(); i != element s.end(); ++i) { | 3750 for (HashSet<HTMLMediaElement*>::iterator i = elements.begin(); i != element s.end(); ++i) { |
3751 if (*i == this) | 3751 if (*i == this) |
3752 continue; | 3752 continue; |
3753 | 3753 |
3754 // and which also has a mediagroup attribute, and whose mediagroup attri bute has the same value as | 3754 // 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, | 3755 // the new value of m's mediagroup attribute, |
3756 if ((*i)->mediaGroup() == group) { | 3756 if ((*i)->mediaGroup() == group) { |
3757 // then let controller be that media element's current media contro ller. | 3757 // then let controller be that media element's current media contro ller. |
3758 setController((*i)->controller()); | 3758 setControllerInternal((*i)->controller()); |
3759 return; | 3759 return; |
3760 } | 3760 } |
3761 } | 3761 } |
3762 | 3762 |
3763 // Otherwise, let controller be a newly created MediaController. | 3763 // Otherwise, let controller be a newly created MediaController. |
3764 setController(MediaController::create(Node::executionContext())); | 3764 setControllerInternal(MediaController::create(Node::executionContext())); |
3765 } | 3765 } |
3766 | 3766 |
3767 MediaController* HTMLMediaElement::controller() const | 3767 MediaController* HTMLMediaElement::controller() const |
3768 { | 3768 { |
3769 return m_mediaController.get(); | 3769 return m_mediaController.get(); |
3770 } | 3770 } |
3771 | 3771 |
3772 void HTMLMediaElement::setController(PassRefPtr<MediaController> controller) | 3772 void HTMLMediaElement::setController(PassRefPtr<MediaController> controller) |
3773 { | 3773 { |
3774 // 4.8.10.11.2 Media controllers: controller attribute. | |
3775 // On setting, it must first remove the element's mediagroup attribute, if a ny, | |
3776 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
| |
3777 // and then set the current media controller to the given value. | |
3778 setControllerInternal(controller); | |
3779 } | |
3780 | |
3781 void HTMLMediaElement::setControllerInternal(PassRefPtr<MediaController> control ler) | |
3782 { | |
3774 if (m_mediaController) | 3783 if (m_mediaController) |
3775 m_mediaController->removeMediaElement(this); | 3784 m_mediaController->removeMediaElement(this); |
3776 | 3785 |
3777 m_mediaController = controller; | 3786 m_mediaController = controller; |
3778 | 3787 |
3779 if (m_mediaController) | 3788 if (m_mediaController) |
3780 m_mediaController->addMediaElement(this); | 3789 m_mediaController->addMediaElement(this); |
3781 | 3790 |
3782 if (hasMediaControls()) | 3791 if (hasMediaControls()) |
3783 mediaControls()->setMediaController(m_mediaController ? m_mediaControlle r.get() : static_cast<MediaControllerInterface*>(this)); | 3792 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 { | 3880 { |
3872 scheduleLayerUpdate(); | 3881 scheduleLayerUpdate(); |
3873 } | 3882 } |
3874 | 3883 |
3875 bool HTMLMediaElement::isInteractiveContent() const | 3884 bool HTMLMediaElement::isInteractiveContent() const |
3876 { | 3885 { |
3877 return fastHasAttribute(controlsAttr); | 3886 return fastHasAttribute(controlsAttr); |
3878 } | 3887 } |
3879 | 3888 |
3880 } | 3889 } |
OLD | NEW |