Bug 486673. <object> elements containing video document should scale the video to fill the document. r+sr=bzbarsky

--HG--
extra : rebase_source : c56e1a7c507f5532dacf2c1589428b5b10f0611d
This commit is contained in:
Robert O'Callahan 2009-04-10 13:14:34 +12:00
Родитель 1ab37ad4c8
Коммит e80ccff07d
6 изменённых файлов: 76 добавлений и 0 удалений

Просмотреть файл

@ -40,6 +40,7 @@
#include "nsNodeInfoManager.h"
#include "nsContentCreatorFunctions.h"
#include "nsHTMLMediaElement.h"
#include "nsIDocShellTreeItem.h"
class nsVideoDocument : public nsMediaDocument
{
@ -119,6 +120,21 @@ nsVideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
element->SetControls(PR_TRUE);
element->LoadWithChannel(aChannel, aListener);
UpdateTitle(aChannel);
nsCOMPtr<nsISupports> container = GetContainer();
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(container));
nsCOMPtr<nsIDocShellTreeItem> sameTypeParent;
if (docShellAsItem) {
docShellAsItem->GetSameTypeParent(getter_AddRefs(sameTypeParent));
}
if (sameTypeParent) {
// Video documents that aren't toplevel should fill their frames and
// not have margins
element->SetAttr(kNameSpaceID_None, nsGkAtoms::style,
NS_LITERAL_STRING("position:absolute; top:0; left:0; width:100%; height:100%"),
PR_TRUE);
}
return body->AppendChildTo(element, PR_FALSE);
}

Просмотреть файл

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1">
<!-- use an empty g to force filters.svg to load before onload -->
<use xlink:href="../filters.svg#empty" />
<foreignObject filter="url(../filters.svg#ThresholdRGB)" x="0" y="0" height="100%" width="100%">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<body style="background:white;">
<object data="black140x100.ogv" style="width:340px; height:100px; position:relative; top:100px;"></object>
</body>
</html>
</foreignObject>
</svg>

После

Ширина:  |  Высота:  |  Размер: 601 B

Просмотреть файл

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1">
<!-- use an empty g to force filters.svg to load before onload -->
<use xlink:href="../filters.svg#empty" />
<foreignObject filter="url(../filters.svg#ThresholdRGB)" x="0" y="0" height="100%" width="100%">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<body style="background:white;">
<object data="black140x100.ogv" style="width:140px; height:300px; position:relative; left:100px;"></object>
</body>
</html>
</foreignObject>
</svg>

После

Ширина:  |  Высота:  |  Размер: 604 B

Просмотреть файл

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1">
<!-- use an empty g to force filters.svg to load before onload -->
<use xlink:href="../filters.svg#empty" />
<foreignObject filter="url(../filters.svg#ThresholdRGB)" x="0" y="0" height="100%" width="100%">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<body style="background:white;">
<object data="black140x100.ogv" style="width:680px; height:200px; position:relative; top:200px;"></object>
</body>
</html>
</foreignObject>
</svg>

После

Ширина:  |  Высота:  |  Размер: 601 B

Просмотреть файл

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1">
<!-- use an empty g to force filters.svg to load before onload -->
<use xlink:href="../filters.svg#empty" />
<foreignObject filter="url(../filters.svg#ThresholdRGB)" x="0" y="0" height="100%" width="100%">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<body style="background:white;">
<object data="black140x100.ogv" style="width:280px; height:600px; position:relative; left:200px;"></object>
</body>
</html>
</foreignObject>
</svg>

После

Ширина:  |  Высота:  |  Размер: 602 B

Просмотреть файл

@ -9,4 +9,8 @@ random HTTP(..) == canvas-1a.xhtml basic-1-ref.html
random HTTP(..) == canvas-1b.xhtml basic-1-ref.html
== empty-1a.html empty-1-ref.html
== empty-1b.html empty-1-ref.html
HTTP(..) == object-aspect-ratio-1a.xhtml aspect-ratio-1-ref.html
HTTP(..) == object-aspect-ratio-1b.xhtml aspect-ratio-1-ref.html
skip-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == object-aspect-ratio-2a.xhtml aspect-ratio-2-ref.html
skip-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == object-aspect-ratio-2b.xhtml aspect-ratio-2-ref.html
skip-if(MOZ_WIDGET_TOOLKIT=="gtk2") HTTP(..) == zoomed-1.xhtml zoomed-1-ref.html