Fix computed style for percents for offset properties when the element doesn't have a frame. (Bug 585715) r=bzbarsky a2.0=blocking+

This commit is contained in:
L. David Baron 2010-08-25 12:17:55 +02:00
parent b4d36c5999
commit c4f2785b8e
3 changed files with 13 additions and 11 deletions

View File

@ -3489,8 +3489,16 @@ nsComputedDOMStyle::GetOffsetWidthFor(mozilla::css::Side aSide,
AssertFlushedPendingReflows();
PRUint8 position = display->mPosition;
if (!mOuterFrame) {
// GetRelativeOffset and GetAbsoluteOffset don't handle elements
// without frames in any sensible way. GetStaticOffset, however,
// is perfect for that case.
position = NS_STYLE_POSITION_STATIC;
}
nsresult rv = NS_OK;
switch (display->mPosition) {
switch (position) {
case NS_STYLE_POSITION_STATIC:
rv = GetStaticOffset(aSide, aValue);
break;

View File

@ -56,13 +56,13 @@ is(getComp("three").bottom, "6px",
is(getComp("three").left, "10px",
"Incorrect computed left offset if specified in %")
is(getComp("four").top, "0px",
is(getComp("four").top, "auto",
"Incorrect undisplayed computed top offset if specified in %")
is(getComp("four").right, "0px",
is(getComp("four").right, "auto",
"Incorrect undisplayed computed right offset if specified in %")
is(getComp("four").bottom, "0px",
is(getComp("four").bottom, "20%",
"Incorrect undisplayed computed bottom offset if specified in %")
is(getComp("four").left, "0px",
is(getComp("four").left, "10%",
"Incorrect undisplayed computed left offset if specified in %")
</script>

View File

@ -69,12 +69,6 @@ var gBadComputedNoFrame = {
"padding-left": [ "0%" ],
"padding-right": [ "0%" ],
"padding-top": [ "0%" ],
// FIXME: file a bug
"top": [ "12%" ],
"right": [ "12%" ],
"bottom": [ "12%" ],
"left": [ "12%" ],
};
function xfail_value(property, value, is_initial, has_frame) {