зеркало из https://github.com/mozilla/pjs.git
Backed out changeset 8ab5a111e00b to fix orange
This commit is contained in:
Родитель
cb5f7b2e3c
Коммит
30a65017ed
|
@ -123,40 +123,22 @@ nsVideoFrame::IsLeaf() const
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// Return the largest rectangle that fits in aRect and has the
|
||||
// same aspect ratio as aRatio, centered at the center of aRect
|
||||
static gfxRect
|
||||
CorrectForAspectRatio(const gfxRect& aRect, const nsIntSize& aRatio)
|
||||
{
|
||||
NS_ASSERTION(aRatio.width > 0 && aRatio.height > 0 && !aRect.IsEmpty(),
|
||||
"Nothing to draw");
|
||||
// Choose scale factor that scales aRatio to just fit into aRect
|
||||
gfxFloat scale =
|
||||
PR_MIN(aRect.Width()/aRatio.width, aRect.Height()/aRatio.height);
|
||||
gfxSize scaledRatio(scale*aRatio.width, scale*aRatio.height);
|
||||
gfxPoint topLeft((aRect.Width() - scaledRatio.width)/2,
|
||||
(aRect.Height() - scaledRatio.height)/2);
|
||||
return gfxRect(aRect.TopLeft() + topLeft, scaledRatio);
|
||||
}
|
||||
|
||||
void
|
||||
nsVideoFrame::PaintVideo(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect, nsPoint aPt)
|
||||
{
|
||||
nsRect area = GetContentRect() - GetPosition() + aPt;
|
||||
nsHTMLVideoElement* element = static_cast<nsHTMLVideoElement*>(GetContent());
|
||||
nsIntSize videoSize = element->GetVideoSize(nsIntSize(0, 0));
|
||||
if (videoSize.width <= 0 || videoSize.height <= 0 || area.IsEmpty())
|
||||
return;
|
||||
|
||||
gfxContext* ctx = static_cast<gfxContext*>(aRenderingContext.GetNativeGraphicData(nsIRenderingContext::NATIVE_THEBES_CONTEXT));
|
||||
// TODO: handle the situation where the frame size is not the same as the
|
||||
// video size, by drawing to the largest rectangle that fits in the frame
|
||||
// whose aspect ratio equals the video's aspect ratio
|
||||
nsRect area = GetContentRect() - GetPosition() + aPt;
|
||||
nsPresContext* presContext = PresContext();
|
||||
gfxRect r = gfxRect(presContext->AppUnitsToGfxUnits(area.x),
|
||||
presContext->AppUnitsToGfxUnits(area.y),
|
||||
presContext->AppUnitsToGfxUnits(area.width),
|
||||
presContext->AppUnitsToGfxUnits(area.height));
|
||||
|
||||
r = CorrectForAspectRatio(r, videoSize);
|
||||
nsHTMLVideoElement* element = static_cast<nsHTMLVideoElement*>(GetContent());
|
||||
element->Paint(ctx, r);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body style="background:white;">
|
||||
<div style="width:140px; height:100px; position:relative; left:100px; top:100px; background:black;"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,8 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<body style="background:white;">
|
||||
<video id="v" src="black140x100.ogv"
|
||||
style="width:340px; height:100px; position:relative; top:100px;"
|
||||
onloadeddata="document.documentElement.removeAttribute('class')"></video>
|
||||
</body>
|
||||
</html>
|
|
@ -1,8 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<body style="background:white;">
|
||||
<video id="v" src="black140x100.ogv"
|
||||
style="width:140px; height:300px; position:relative; left:100px;"
|
||||
onloadeddata="document.documentElement.removeAttribute('class')"></video>
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body style="background:white;">
|
||||
<div style="width:280px; height:200px; position:relative; left:200px; top:200px; background:black;"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,8 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<body style="background:white;">
|
||||
<video id="v" src="black140x100.ogv"
|
||||
style="width:680px; height:200px; position:relative; top:200px;"
|
||||
onloadeddata="document.documentElement.removeAttribute('class')"></video>
|
||||
</body>
|
||||
</html>
|
|
@ -1,8 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<body style="background:white;">
|
||||
<video id="v" src="black140x100.ogv"
|
||||
style="width:280px; height:600px; position:relative; left:200px;"
|
||||
onloadeddata="document.documentElement.removeAttribute('class')"></video>
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body style="background:white;">
|
||||
<div style="width:140px; height:100px; background:black;"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,7 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<body style="background:white;">
|
||||
<video id="v" src="black140x100.ogv"
|
||||
onloadeddata="document.documentElement.removeAttribute('class')"></video>
|
||||
</body>
|
||||
</html>
|
Двоичные данные
layout/reftests/ogg-video/black140x100.ogv
Двоичные данные
layout/reftests/ogg-video/black140x100.ogv
Двоичный файл не отображается.
|
@ -1,5 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body style="background:white;">
|
||||
</body>
|
||||
</html>
|
|
@ -1,7 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<body style="background:white;">
|
||||
<video id="v" src="black140x100.ogv" style="width:0"
|
||||
onloadeddata="document.documentElement.removeAttribute('class')"></video>
|
||||
</body>
|
||||
</html>
|
|
@ -1,7 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<body style="background:white;">
|
||||
<video id="v" src="black140x100.ogv" style="height:0"
|
||||
onloadeddata="document.documentElement.removeAttribute('class')"></video>
|
||||
</body>
|
||||
</html>
|
|
@ -1,8 +0,0 @@
|
|||
== aspect-ratio-1a.html aspect-ratio-1-ref.html
|
||||
== aspect-ratio-1b.html aspect-ratio-1-ref.html
|
||||
== aspect-ratio-2a.html aspect-ratio-2-ref.html
|
||||
== aspect-ratio-2b.html aspect-ratio-2-ref.html
|
||||
== basic-1.html basic-1-ref.html
|
||||
== empty-1a.html empty-1-ref.html
|
||||
== empty-1b.html empty-1-ref.html
|
||||
== zoomed-1.html zoomed-1-ref.html
|
|
@ -1,6 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body style="background:white; margin:0;">
|
||||
<div style="width:210px; height:150px; background:black;"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,7 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait" reftest-zoom="1.5">
|
||||
<body style="background:white; margin:0">
|
||||
<video id="v" src="black140x100.ogv"
|
||||
onloadeddata="document.documentElement.removeAttribute('class')"></video>
|
||||
</body>
|
||||
</html>
|
|
@ -83,9 +83,6 @@ include native-theme/reftest.list
|
|||
# object/
|
||||
include object/reftest.list
|
||||
|
||||
# ogg-video/
|
||||
include ogg-video/reftest.list
|
||||
|
||||
# percent-overflow-sizing/
|
||||
include percent-overflow-sizing/reftest.list
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче