summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/RenderVideo.cpp
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
commit1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 (patch)
tree4457a7306ea5acb43fe05bfe0973b1f7faf97ba2 /WebCore/rendering/RenderVideo.cpp
parent9364f22aed35e1a1e9d07c121510f80be3ab0502 (diff)
downloadexternal_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.zip
external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.gz
external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.bz2
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'WebCore/rendering/RenderVideo.cpp')
-rw-r--r--WebCore/rendering/RenderVideo.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/WebCore/rendering/RenderVideo.cpp b/WebCore/rendering/RenderVideo.cpp
index 041bd57..d677725 100644
--- a/WebCore/rendering/RenderVideo.cpp
+++ b/WebCore/rendering/RenderVideo.cpp
@@ -50,7 +50,7 @@ RenderVideo::~RenderVideo()
{
if (MediaPlayer* p = player()) {
p->setVisible(false);
- p->setParentWidget(0);
+ p->setFrameView(0);
}
}
@@ -59,7 +59,7 @@ void RenderVideo::videoSizeChanged()
if (!player())
return;
IntSize size = player()->naturalSize();
- if (size != intrinsicSize()) {
+ if (!size.isEmpty() && size != intrinsicSize()) {
setIntrinsicSize(size);
setPrefWidthsDirty(true);
setNeedsLayout(true);
@@ -120,15 +120,16 @@ void RenderVideo::updatePlayer()
MediaPlayer* mediaPlayer = player();
if (!mediaPlayer)
return;
- Document* doc = document();
- if (doc->inPageCache())
+ if (!mediaElement()->inActiveDocument()) {
+ mediaPlayer->setVisible(false);
return;
+ }
int x;
int y;
absolutePosition(x, y);
IntRect videoBounds = videoBox();
videoBounds.move(x, y);
- mediaPlayer->setParentWidget(doc->view());
+ mediaPlayer->setFrameView(document()->view());
mediaPlayer->setRect(videoBounds);
mediaPlayer->setVisible(true);
}
@@ -167,7 +168,7 @@ bool RenderVideo::isHeightSpecified() const
return false;
}
-int RenderVideo::calcReplacedWidth() const
+int RenderVideo::calcReplacedWidth(bool includeMaxWidth) const
{
int width;
if (isWidthSpecified())
@@ -176,7 +177,7 @@ int RenderVideo::calcReplacedWidth() const
width = calcAspectRatioWidth();
int minW = calcReplacedWidthUsing(style()->minWidth());
- int maxW = style()->maxWidth().isUndefined() ? width : calcReplacedWidthUsing(style()->maxWidth());
+ int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : calcReplacedWidthUsing(style()->maxWidth());
return max(minW, min(width, maxW));
}
@@ -217,7 +218,11 @@ void RenderVideo::calcPrefWidths()
{
ASSERT(prefWidthsDirty());
- m_maxPrefWidth = calcReplacedWidth() + paddingLeft() + paddingRight() + borderLeft() + borderRight();
+ int paddingAndBorders = paddingLeft() + paddingRight() + borderLeft() + borderRight();
+ m_maxPrefWidth = calcReplacedWidth(false) + paddingAndBorders;
+
+ if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength)
+ m_maxPrefWidth = min(m_maxPrefWidth, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? paddingAndBorders : 0));
if (style()->width().isPercent() || style()->height().isPercent() ||
style()->maxWidth().isPercent() || style()->maxHeight().isPercent() ||