summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp')
-rw-r--r--src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp42
1 files changed, 32 insertions, 10 deletions
diff --git a/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp b/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp
index d66519a..fc2790c 100644
--- a/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp
+++ b/src/3rdparty/webkit/WebCore/rendering/MediaControlElements.cpp
@@ -101,6 +101,7 @@ void MediaTextDisplayElement::update()
{
if (renderer())
renderer()->updateFromElement();
+ updateStyle();
}
void MediaTextDisplayElement::updateStyle()
@@ -125,13 +126,7 @@ MediaControlInputElement::MediaControlInputElement(Document* doc, PseudoId pseud
, m_displayType(displayType)
{
setInputType(type);
- RenderStyle* style = m_mediaElement->renderer()->getCachedPseudoStyle(m_pseudoStyleId);
- RenderObject* renderer = createRenderer(m_mediaElement->renderer()->renderArena(), style);
- if (renderer) {
- setRenderer(renderer);
- renderer->setStyle(style);
- }
- setAttached();
+ updateStyle();
setInDocument(true);
}
@@ -147,14 +142,35 @@ void MediaControlInputElement::update()
updateDisplayType();
if (renderer())
renderer()->updateFromElement();
+ updateStyle();
}
void MediaControlInputElement::updateStyle()
{
- if (renderer() && m_mediaElement->renderer()) {
- RenderStyle* style = m_mediaElement->renderer()->getCachedPseudoStyle(m_pseudoStyleId);
+ if (!m_mediaElement || !m_mediaElement->renderer())
+ return;
+
+ RenderStyle* style = m_mediaElement->renderer()->getCachedPseudoStyle(m_pseudoStyleId);
+
+ bool needsRenderer = rendererIsNeeded(style);
+ if (renderer() && !needsRenderer)
+ detach();
+ else if (!renderer() && needsRenderer) {
+ RenderObject* renderer = createRenderer(m_mediaElement->renderer()->renderArena(), style);
+ if (!renderer)
+ return;
+ renderer->setStyle(style);
+ setRenderer(renderer);
+ setAttached();
+ if (parent() && parent()->renderer()) {
+ // Find next sibling with a renderer to determine where to insert.
+ Node* sibling = nextSibling();
+ while (sibling && !sibling->renderer())
+ sibling = sibling->nextSibling();
+ parent()->renderer()->addChild(renderer, sibling ? sibling->renderer() : 0);
+ }
+ } else if (renderer())
renderer()->setStyle(style);
- }
}
bool MediaControlInputElement::hitTest(const IntPoint& absPoint)
@@ -323,6 +339,12 @@ void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event)
HTMLInputElement::defaultEventHandler(event);
}
+bool MediaControlFullscreenButtonElement::rendererIsNeeded(RenderStyle* style)
+{
+ return m_mediaElement->supportsFullscreen() && MediaControlInputElement::rendererIsNeeded(style);
+}
+
+
// ----------------------------
} //namespace WebCore