Bug 613722 - Do not make <embed hidden> display none. r=jst a=blocking-betaN

This commit is contained in:
Mounir Lamouri 2010-12-03 15:22:11 +01:00
parent 1e9c4a160e
commit 9c611e62d4
6 changed files with 76 additions and 2 deletions

View File

@ -1629,8 +1629,8 @@ nsGenericHTMLElement::ParseScrollingValue(const nsAString& aString,
* Handle attributes common to all html elements
*/
void
nsGenericHTMLElement::MapCommonAttributesInto(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
nsGenericHTMLElement::MapCommonAttributesExceptHiddenInto(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(UserInterface)) {
nsRuleDataUserInterface *ui = aData->mUserInterfaceData;
@ -1658,6 +1658,13 @@ nsGenericHTMLElement::MapCommonAttributesInto(const nsMappedAttributes* aAttribu
eCSSUnit_Ident);
}
}
}
void
nsGenericHTMLElement::MapCommonAttributesInto(const nsMappedAttributes* aAttributes,
nsRuleData* aData)
{
nsGenericHTMLElement::MapCommonAttributesExceptHiddenInto(aAttributes, aData);
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Display)) {
nsRuleDataDisplay* disp = aData->mDisplayData;

View File

@ -331,6 +331,15 @@ public:
*/
static void MapCommonAttributesInto(const nsMappedAttributes* aAttributes,
nsRuleData* aRuleData);
/**
* This method is used by embed elements because they should ignore the hidden
* attribute for the moment.
* TODO: This should be removed when bug 614825 will be fixed.
*/
static void MapCommonAttributesExceptHiddenInto(const nsMappedAttributes* aAttributes,
nsRuleData* aRuleData);
static const MappedAttributeEntry sCommonAttributeMap[];
static const MappedAttributeEntry sImageMarginSizeAttributeMap[];
static const MappedAttributeEntry sImageBorderAttributeMap[];

View File

@ -420,6 +420,21 @@ MapAttributesIntoRule(const nsMappedAttributes *aAttributes,
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}
static void
EmbedMapAttributesIntoRule(const nsMappedAttributes *aAttributes,
nsRuleData *aData)
{
// NOTE: this should call the exact some methods than MapAttributesIntoRule
// except that MapCommonAttributesExceptHiddenInto is called instead of
// MapCommonAttributesInto.
// TODO: This method should be removed when bug 614825 will be fixed.
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesExceptHiddenInto(aAttributes, aData);
}
NS_IMETHODIMP_(PRBool)
nsHTMLSharedObjectElement::IsAttributeMapped(const nsIAtom *aAttribute) const
{
@ -437,6 +452,10 @@ nsHTMLSharedObjectElement::IsAttributeMapped(const nsIAtom *aAttribute) const
nsMapRuleToAttributesFunc
nsHTMLSharedObjectElement::GetAttributeMappingFunction() const
{
if (mNodeInfo->Equals(nsGkAtoms::embed)) {
return &EmbedMapAttributesIntoRule;
}
return &MapAttributesIntoRule;
}

View File

@ -249,6 +249,7 @@ _TEST_FILES = \
test_bug605125-1.html \
test_bug605125-2.html \
test_bug612730.html \
test_bug613722.html \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -0,0 +1,37 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=613722
-->
<head>
<title>Test for Bug 613722</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=613722">Mozilla Bug 613722</a>
<p id="display"></p>
<div id="content">
<embed src="test_plugin.tst" hidden>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 613722 **/
/**
* TODO: this test should be removed when bug 614825 will be fixed.
*/
var rect = document.getElementsByTagName('embed')[0].getBoundingClientRect();
var hasFrame = rect.left != 0 || rect.right != 0 || rect.top != 0 ||
rect.bottom != 0;
ok(hasFrame, "embed should have a frame with hidden set");
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1 @@
foobar