summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/rendering/RenderMedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/RenderMedia.cpp')
-rw-r--r--Source/WebCore/rendering/RenderMedia.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/Source/WebCore/rendering/RenderMedia.cpp b/Source/WebCore/rendering/RenderMedia.cpp
index 16cd874..bbb5880 100644
--- a/Source/WebCore/rendering/RenderMedia.cpp
+++ b/Source/WebCore/rendering/RenderMedia.cpp
@@ -31,6 +31,7 @@
#include "HTMLMediaElement.h"
#include "MediaControlElements.h"
#include "MediaControls.h"
+#include "RenderView.h"
namespace WebCore {
@@ -80,17 +81,24 @@ void RenderMedia::layout()
if (!controlsRenderer)
return;
IntSize newSize = contentBoxRect().size();
- if (newSize != oldSize || controlsRenderer->needsLayout()) {
+ if (newSize == oldSize && !controlsRenderer->needsLayout())
+ return;
+
+ // When calling layout() on a child node, a parent must either push a LayoutStateMaintainter, or
+ // call view()->disableLayoutState(). Since using a LayoutStateMaintainer is slightly more efficient,
+ // and this method will be called many times per second during playback, use a LayoutStateMaintainer:
+ LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());
+
+ m_controls->updateTimeDisplayVisibility();
- m_controls->updateTimeDisplayVisibility();
+ controlsRenderer->setLocation(borderLeft() + paddingLeft(), borderTop() + paddingTop());
+ controlsRenderer->style()->setHeight(Length(newSize.height(), Fixed));
+ controlsRenderer->style()->setWidth(Length(newSize.width(), Fixed));
+ controlsRenderer->setNeedsLayout(true, false);
+ controlsRenderer->layout();
+ setChildNeedsLayout(false);
- controlsRenderer->setLocation(borderLeft() + paddingLeft(), borderTop() + paddingTop());
- controlsRenderer->style()->setHeight(Length(newSize.height(), Fixed));
- controlsRenderer->style()->setWidth(Length(newSize.width(), Fixed));
- controlsRenderer->setNeedsLayout(true, false);
- controlsRenderer->layout();
- setChildNeedsLayout(false);
- }
+ statePusher.pop();
}
void RenderMedia::updateFromElement()