Bug 1230508 - Always compute position to fixed for top layer elements for now. r=dbaron

Although the spec says absolute is allowed for top layer elements, and actually
other values should be computed to absolute, but this is mostly fine because
the only way we currently support for web content to use the top layer is via
the Fullscreen API, however, fullscreen elements are forced to be fixed by the
UA sheet.

Given only fixed is safe for top layer element currently, rather than doing
what the spec says, we should prefer always force it, until we really add
support for the other value.
This commit is contained in:
Xidorn Quan 2015-12-14 12:31:23 +11:00
parent 275e35613a
commit d81577181d

View File

@ -5724,8 +5724,14 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
// positioned, the position value should be computed to 'absolute' per
// the Fullscreen API spec.
if (display->mTopLayer != NS_STYLE_TOP_LAYER_NONE &&
!display->IsAbsolutelyPositionedStyle()) {
display->mPosition = NS_STYLE_POSITION_ABSOLUTE;
// XXX We currently only support fixed top layer element. But per
// spec it should check IsAbsolutelyPositionedStyle() instead.
// This should be fixed as soon as we support <dialog> element
// in bug 840640. We have to restrict it now because addons may
// mess with UA-only styles and cause crashes. See bug 1230508.
display->mPosition != NS_STYLE_POSITION_FIXED) {
// XXX And we should set other values to absolute instead of fixed.
display->mPosition = NS_STYLE_POSITION_FIXED;
// We cannot cache this struct because otherwise it may be used as
// an aStartStruct for some other elements.
conditions.SetUncacheable();