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 347993 ede61fb46d963115c97ec28e6df4ade55e71d78f
parent 347992 a40ca7215aa61ec833a5f441f599eebca46bffd0
child 517756 5ba7b8e5e278c44b17c5c2f5ce16afc115567cc1
push id14721
push userxquan@mozilla.com
push dateWed, 06 Apr 2016 08:50:23 +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,