This source file includes following definitions.
- mediaElement
- layout
- paintReplaced
#include "config.h"
#include "core/rendering/RenderMedia.h"
#include "core/html/HTMLMediaElement.h"
#include "core/rendering/LayoutRectRecorder.h"
#include "core/rendering/RenderView.h"
namespace WebCore {
RenderMedia::RenderMedia(HTMLMediaElement* video)
: RenderImage(video)
{
setImageResource(RenderImageResource::create());
}
RenderMedia::~RenderMedia()
{
}
HTMLMediaElement* RenderMedia::mediaElement() const
{
return toHTMLMediaElement(node());
}
void RenderMedia::layout()
{
LayoutRectRecorder recorder(*this);
LayoutSize oldSize = contentBoxRect().size();
RenderImage::layout();
RenderBox* controlsRenderer = toRenderBox(m_children.firstChild());
if (!controlsRenderer)
return;
bool controlsNeedLayout = controlsRenderer->needsLayout();
LayoutSize newSize = contentBoxRect().size();
if (newSize == oldSize && !controlsNeedLayout)
return;
LayoutStateMaintainer statePusher(*this, locationOffset());
controlsRenderer->setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSize(paddingLeft(), paddingTop()));
controlsRenderer->style()->setHeight(Length(newSize.height(), Fixed));
controlsRenderer->style()->setWidth(Length(newSize.width(), Fixed));
controlsRenderer->forceLayout();
clearNeedsLayout();
}
void RenderMedia::paintReplaced(PaintInfo&, const LayoutPoint&)
{
}
}