Bug 1236828 part 3 - Allow setting position: absolute for top layer element. r?dbaron draft
authorXidorn Quan <quanxunzhen@gmail.com>
Tue, 05 Apr 2016 20:06:40 +1000
changeset 347996 23ed10c51038041cd7e6ed94ac2131f0ce51b76e
parent 347995 4a9145ae958b3c1b3072524c37a6d5a4dc4bbe22
child 517757 933bd87e86ad056d973ac5a21249ae7824aeadba
push id14722
push userxquan@mozilla.com
push dateWed, 06 Apr 2016 08:52:56 +0000
reviewersdbaron
bugs1236828
milestone48.0a1
Bug 1236828 part 3 - Allow setting position: absolute for top layer element. r?dbaron MozReview-Commit-ID: 9BMGe88eq6g
layout/style/nsRuleNode.cpp
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -5851,24 +5851,18 @@ nsRuleNode::ComputeDisplayData(void* aSt
   SetDiscrete(*aRuleData->ValueForPosition(), display->mPosition, conditions,
               SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,
               parentDisplay->mPosition,
               NS_STYLE_POSITION_STATIC, 0, 0, 0, 0);
   // If an element is put in the top layer, while it is not absolutely
   // positioned, the position value should be computed to 'absolute' per
   // the Fullscreen API spec.
   if (display->mTopLayer != NS_STYLE_TOP_LAYER_NONE &&
-      // 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;
+      !display->IsAbsolutelyPositionedStyle()) {
+    display->mPosition = NS_STYLE_POSITION_ABSOLUTE;
     // We cannot cache this struct because otherwise it may be used as
     // an aStartStruct for some other elements.
     conditions.SetUncacheable();
   }
 
   // clear: enum, inherit, initial
   SetDiscrete(*aRuleData->ValueForClear(), display->mBreakType, conditions,
               SETDSC_ENUMERATED | SETDSC_UNSET_INITIAL,