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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/core/html/HTMLMediaElement.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3704 matching lines...) Expand 10 before | Expand all | Expand 10 after
3715 3715
3716 AudioSourceProvider* HTMLMediaElement::audioSourceProvider() 3716 AudioSourceProvider* HTMLMediaElement::audioSourceProvider()
3717 { 3717 {
3718 if (m_player) 3718 if (m_player)
3719 return m_player->audioSourceProvider(); 3719 return m_player->audioSourceProvider();
3720 3720
3721 return 0; 3721 return 0;
3722 } 3722 }
3723 #endif 3723 #endif
3724 3724
3725 const String& HTMLMediaElement::mediaGroup() const 3725 const AtomicString& HTMLMediaElement::mediaGroup() const
3726 { 3726 {
3727 return m_mediaGroup; 3727 return fastGetAttribute(mediagroupAttr);
3728 } 3728 }
3729 3729
3730 void HTMLMediaElement::setMediaGroup(const String& group) 3730 void HTMLMediaElement::setMediaGroup(const AtomicString& group)
3731 { 3731 {
3732 if (m_mediaGroup == group)
3733 return;
3734 m_mediaGroup = group;
3735
3736 // When a media element is created with a mediagroup attribute, and when a m edia element's mediagroup 3732 // When a media element is created with a mediagroup attribute, and when a m edia element's mediagroup
3737 // attribute is set, changed, or removed, the user agent must run the follow ing steps: 3733 // attribute is set, changed, or removed, the user agent must run the follow ing steps:
3738 // 1. Let m [this] be the media element in question. 3734 // 1. Let m [this] be the media element in question.
3739 // 2. Let m have no current media controller, if it currently has one. 3735 // 2. Let m have no current media controller, if it currently has one.
3740 setController(0); 3736 setControllerInternal(0);
3741 3737
3742 // 3. If m's mediagroup attribute is being removed, then abort these steps. 3738 // 3. If m's mediagroup attribute is being removed, then abort these steps.
3743 if (group.isNull() || group.isEmpty()) 3739 if (group.isNull() || group.isEmpty())
3744 return; 3740 return;
3745 3741
3746 // 4. If there is another media element whose Document is the same as m's Do cument (even if one or both 3742 // 4. If there is another media element whose Document is the same as m's Do cument (even if one or both
3747 // of these elements are not actually in the Document), 3743 // of these elements are not actually in the Document),
3748 HashSet<HTMLMediaElement*> elements = documentToElementSetMap().get(&documen t()); 3744 HashSet<HTMLMediaElement*> elements = documentToElementSetMap().get(&documen t());
3749 for (HashSet<HTMLMediaElement*>::iterator i = elements.begin(); i != element s.end(); ++i) { 3745 for (HashSet<HTMLMediaElement*>::iterator i = elements.begin(); i != element s.end(); ++i) {
3750 if (*i == this) 3746 if (*i == this)
3751 continue; 3747 continue;
3752 3748
3753 // and which also has a mediagroup attribute, and whose mediagroup attri bute has the same value as 3749 // and which also has a mediagroup attribute, and whose mediagroup attri bute has the same value as
3754 // the new value of m's mediagroup attribute, 3750 // the new value of m's mediagroup attribute,
3755 if ((*i)->mediaGroup() == group) { 3751 if ((*i)->mediaGroup() == group) {
3756 // then let controller be that media element's current media contro ller. 3752 // then let controller be that media element's current media contro ller.
3757 setController((*i)->controller()); 3753 setControllerInternal((*i)->controller());
3758 return; 3754 return;
3759 } 3755 }
3760 } 3756 }
3761 3757
3762 // Otherwise, let controller be a newly created MediaController. 3758 // Otherwise, let controller be a newly created MediaController.
3763 setController(MediaController::create(Node::executionContext())); 3759 setControllerInternal(MediaController::create(Node::executionContext()));
3764 } 3760 }
3765 3761
3766 MediaController* HTMLMediaElement::controller() const 3762 MediaController* HTMLMediaElement::controller() const
3767 { 3763 {
3768 return m_mediaController.get(); 3764 return m_mediaController.get();
3769 } 3765 }
3770 3766
3771 void HTMLMediaElement::setController(PassRefPtr<MediaController> controller) 3767 void HTMLMediaElement::setController(PassRefPtr<MediaController> controller)
3772 { 3768 {
3769 // 4.8.10.11.2 Media controllers: controller attribute.
3770 // On setting, it must first remove the element's mediagroup attribute, if a ny,
3771 removeAttribute(mediagroupAttr);
3772 // and then set the current media controller to the given value.
3773 setControllerInternal(controller);
3774 }
3775
3776 void HTMLMediaElement::setControllerInternal(PassRefPtr<MediaController> control ler)
3777 {
3773 if (m_mediaController) 3778 if (m_mediaController)
3774 m_mediaController->removeMediaElement(this); 3779 m_mediaController->removeMediaElement(this);
3775 3780
3776 m_mediaController = controller; 3781 m_mediaController = controller;
3777 3782
3778 if (m_mediaController) 3783 if (m_mediaController)
3779 m_mediaController->addMediaElement(this); 3784 m_mediaController->addMediaElement(this);
3780 3785
3781 if (hasMediaControls()) 3786 if (hasMediaControls())
3782 mediaControls()->setMediaController(m_mediaController ? m_mediaControlle r.get() : static_cast<MediaControllerInterface*>(this)); 3787 mediaControls()->setMediaController(m_mediaController ? m_mediaControlle r.get() : static_cast<MediaControllerInterface*>(this));
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
3870 { 3875 {
3871 scheduleLayerUpdate(); 3876 scheduleLayerUpdate();
3872 } 3877 }
3873 3878
3874 bool HTMLMediaElement::isInteractiveContent() const 3879 bool HTMLMediaElement::isInteractiveContent() const
3875 { 3880 {
3876 return fastHasAttribute(controlsAttr); 3881 return fastHasAttribute(controlsAttr);
3877 } 3882 }
3878 3883
3879 } 3884 }
OLDNEW
« 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