Index: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp |
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp |
index 087b1013c313014963936a4221c8eedf8a6e6212..21e0cc0e175e852aab831c3fe2fec1a4fa3981ee 100644 |
--- a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp |
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp |
@@ -338,6 +338,35 @@ void MediaControls::initializeControls() { |
*this, MediaControlToggleClosedCaptionsButtonElement::create(*this))); |
} |
+Node::InsertionNotificationRequest MediaControls::insertedInto( |
+ ContainerNode* root) { |
+ if (!mediaElement().isConnected()) |
+ return HTMLDivElement::insertedInto(root); |
+ |
+ // TODO(mlamouri): we should show the controls instead of having |
+ // HTMLMediaElement do it. |
+ |
+ // m_windowEventListener doesn't need to be re-attached as it's only needed |
+ // when a menu is visible. |
+ m_mediaEventListener->attach(); |
+ if (m_orientationLockDelegate) |
+ m_orientationLockDelegate->attach(); |
+ |
+ return HTMLDivElement::insertedInto(root); |
+} |
+ |
+void MediaControls::removedFrom(ContainerNode*) { |
+ DCHECK(!mediaElement().isConnected()); |
+ |
+ // TODO(mlamouri): we hide show the controls instead of having |
+ // HTMLMediaElement do it. |
+ |
+ m_windowEventListener->stop(); |
+ m_mediaEventListener->detach(); |
+ if (m_orientationLockDelegate) |
+ m_orientationLockDelegate->detach(); |
+} |
+ |
void MediaControls::reset() { |
EventDispatchForbiddenScope::AllowUserAgentEvents allowEventsInShadow; |
BatchedControlUpdate batch(this); |
@@ -688,27 +717,6 @@ bool MediaControls::containsRelatedTarget(Event* event) { |
return contains(relatedTarget->toNode()); |
} |
-void MediaControls::onInsertedIntoDocument() { |
- // TODO(mlamouri): we should show the controls instead of having |
- // HTMLMediaElement do it. |
- |
- // m_windowEventListener doesn't need to be re-attached as it's only needed |
- // when a menu is visible. |
- m_mediaEventListener->attach(); |
- if (m_orientationLockDelegate) |
- m_orientationLockDelegate->attach(); |
-} |
- |
-void MediaControls::onRemovedFromDocument() { |
- // TODO(mlamouri): we hide show the controls instead of having |
- // HTMLMediaElement do it. |
- |
- m_windowEventListener->stop(); |
- m_mediaEventListener->detach(); |
- if (m_orientationLockDelegate) |
- m_orientationLockDelegate->detach(); |
-} |
- |
void MediaControls::onVolumeChange() { |
m_muteButton->updateDisplayType(); |
m_volumeSlider->setVolume(mediaElement().muted() ? 0 |