This source file includes following definitions.
- toParentMediaElement
- mediaControlElementType
- m_element
- mediaElement
- hide
- show
- setDisplayType
- MediaControlElement
- MediaControlElement
- isMouseFocusable
- m_currentValue
- setCurrentValue
#include "config.h"
#include "core/html/shadow/MediaControlElementTypes.h"
#include "CSSValueKeywords.h"
#include "HTMLNames.h"
#include "bindings/v8/ExceptionStatePlaceholder.h"
#include "core/css/StylePropertySet.h"
#include "core/events/MouseEvent.h"
#include "core/html/HTMLMediaElement.h"
#include "core/html/shadow/MediaControls.h"
namespace WebCore {
using namespace HTMLNames;
class Event;
HTMLMediaElement* toParentMediaElement(Node* node)
{
if (!node)
return 0;
Node* mediaNode = node->shadowHost();
if (!mediaNode)
mediaNode = node;
if (!isHTMLMediaElement(mediaNode))
return 0;
return toHTMLMediaElement(mediaNode);
}
MediaControlElementType mediaControlElementType(Node* node)
{
ASSERT_WITH_SECURITY_IMPLICATION(node->isMediaControlElement());
HTMLElement* element = toHTMLElement(node);
if (isHTMLInputElement(*element))
return static_cast<MediaControlInputElement*>(element)->displayType();
return static_cast<MediaControlDivElement*>(element)->displayType();
}
MediaControlElement::MediaControlElement(MediaControls& mediaControls, MediaControlElementType displayType, HTMLElement* element)
: m_mediaControls(mediaControls)
, m_displayType(displayType)
, m_element(element)
{
}
HTMLMediaElement& MediaControlElement::mediaElement() const
{
return mediaControls().mediaElement();
}
void MediaControlElement::hide()
{
m_element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
}
void MediaControlElement::show()
{
m_element->removeInlineStyleProperty(CSSPropertyDisplay);
}
void MediaControlElement::setDisplayType(MediaControlElementType displayType)
{
if (displayType == m_displayType)
return;
m_displayType = displayType;
if (RenderObject* object = m_element->renderer())
object->repaint();
}
MediaControlDivElement::MediaControlDivElement(MediaControls& mediaControls, MediaControlElementType displayType)
: HTMLDivElement(mediaControls.document())
, MediaControlElement(mediaControls, displayType, this)
{
}
MediaControlInputElement::MediaControlInputElement(MediaControls& mediaControls, MediaControlElementType displayType)
: HTMLInputElement(mediaControls.document(), 0, false)
, MediaControlElement(mediaControls, displayType, this)
{
}
bool MediaControlInputElement::isMouseFocusable() const
{
return false;
}
MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(MediaControls& mediaControls, MediaControlElementType displayType)
: MediaControlDivElement(mediaControls, displayType)
, m_currentValue(0)
{
}
void MediaControlTimeDisplayElement::setCurrentValue(double time)
{
m_currentValue = time;
}
}