зеркало из https://github.com/mozilla/gecko-dev.git
Bug 479936 - Correctly handle sizing of video elements
This commit is contained in:
Родитель
4a6f404c84
Коммит
13cb33fda3
|
@ -63,6 +63,13 @@ public:
|
|||
// nsIDOMHTMLVideoElement
|
||||
NS_DECL_NSIDOMHTMLVIDEOELEMENT
|
||||
|
||||
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult);
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
// Returns the current video frame width and height.
|
||||
|
|
|
@ -113,3 +113,48 @@ nsIntSize nsHTMLVideoElement::GetVideoSize(nsIntSize aDefaultSize)
|
|||
{
|
||||
return mMediaSize.width == -1 && mMediaSize.height == -1 ? aDefaultSize : mMediaSize;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLVideoElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
|
||||
return nsHTMLMediaElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
||||
aResult);
|
||||
}
|
||||
|
||||
static void
|
||||
MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aData)
|
||||
{
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
nsHTMLVideoElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
static const MappedAttributeEntry attributes[] = {
|
||||
{ &nsGkAtoms::width },
|
||||
{ &nsGkAtoms::height },
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap
|
||||
};
|
||||
|
||||
return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
|
||||
}
|
||||
|
||||
nsMapRuleToAttributesFunc
|
||||
nsHTMLVideoElement::GetAttributeMappingFunction() const
|
||||
{
|
||||
return &MapAttributesIntoRule;
|
||||
}
|
||||
|
|
|
@ -330,20 +330,6 @@ nsSize nsVideoFrame::GetIntrinsicSize(nsIRenderingContext *aRenderingContext)
|
|||
nsresult rv;
|
||||
|
||||
size = element->GetVideoSize(size);
|
||||
if (element->HasAttr(kNameSpaceID_None, nsGkAtoms::width)) {
|
||||
PRInt32 width = -1;
|
||||
rv = element->GetWidth(&width);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
size.width = width;
|
||||
}
|
||||
}
|
||||
if (element->HasAttr(kNameSpaceID_None, nsGkAtoms::height)) {
|
||||
PRInt32 height = -1;
|
||||
rv = element->GetHeight(&height);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
size.height = height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nsSize(nsPresContext::CSSPixelsToAppUnits(size.width),
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<body style="background:white;">
|
||||
<video id="v" src="black140x100.ogv"
|
||||
style="width:280px; height:200px;"
|
||||
onloadeddata="document.documentElement.removeAttribute('class')"></video>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<body style="background:white;">
|
||||
<video id="v" src="black140x100.ogv" width="280"
|
||||
onloadeddata="document.documentElement.removeAttribute('class')"></video>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<body style="background:white;">
|
||||
<video id="v" src="black140x100.ogv" height="200"
|
||||
onloadeddata="document.documentElement.removeAttribute('class')"></video>
|
||||
</body>
|
||||
</html>
|
|
@ -2,6 +2,8 @@
|
|||
== 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
|
||||
== aspect-ratio-3a.html aspect-ratio-3-ref.html
|
||||
== aspect-ratio-3b.html aspect-ratio-3-ref.html
|
||||
== basic-1.html basic-1-ref.html
|
||||
== canvas-1a.html basic-1-ref.html
|
||||
== canvas-1b.html basic-1-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче