Bug 1184842. Remove layout.frames.force_resizability pref. r=mats
authorRobert O'Callahan <robert@ocallahan.org>
Tue, 21 Jul 2015 16:18:17 +1200
changeset 287663 86d881ad9429355be61f271363b19d181fef366c
parent 287662 48a62f1685e111e3e79b963375374acddbf5cee4
child 287664 4e87cabdf930af16ba0c1b79b258df220203b2e8
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1184842
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1184842. Remove layout.frames.force_resizability pref. r=mats
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsFrameSetFrame.h
modules/libpref/init/all.js
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -167,17 +167,16 @@ protected:
   friend class nsHTMLFramesetFrame;
   friend class nsHTMLFrameset;
 };
 
 /*******************************************************************************
  * nsHTMLFramesetFrame
  ******************************************************************************/
 bool    nsHTMLFramesetFrame::gDragInProgress = false;
-#define kFrameResizePref "layout.frames.force_resizability"
 #define DEFAULT_BORDER_WIDTH_PX 6
 
 nsHTMLFramesetFrame::nsHTMLFramesetFrame(nsStyleContext* aContext)
   : nsContainerFrame(aContext)
 {
   mNumRows             = 0;
   mRowSizes            = nullptr;
   mNumCols             = 0;
@@ -193,64 +192,32 @@ nsHTMLFramesetFrame::nsHTMLFramesetFrame
   mDragger             = nullptr;
   mChildCount          = 0;
   mTopLevelFrameset    = nullptr;
   mEdgeColors.Set(NO_COLOR);
   mVerBorders          = nullptr;
   mHorBorders          = nullptr;
   mChildFrameborder    = nullptr;
   mChildBorderColors   = nullptr;
-  mForceFrameResizability = false;
 }
 
 nsHTMLFramesetFrame::~nsHTMLFramesetFrame()
 {
   delete[] mRowSizes;
   delete[] mColSizes;
   delete[] mVerBorders;
   delete[] mHorBorders;
   delete[] mChildFrameborder;
   delete[] mChildBorderColors;
-
-  Preferences::UnregisterCallback(FrameResizePrefCallback,
-                                  kFrameResizePref, this);
 }
 
 NS_QUERYFRAME_HEAD(nsHTMLFramesetFrame)
   NS_QUERYFRAME_ENTRY(nsHTMLFramesetFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
 
-// static
-void
-nsHTMLFramesetFrame::FrameResizePrefCallback(const char* aPref, void* aClosure)
-{
-  nsHTMLFramesetFrame *frame =
-    reinterpret_cast<nsHTMLFramesetFrame *>(aClosure);
-
-  nsIDocument* doc = frame->mContent->GetComposedDoc();
-  mozAutoDocUpdate updateBatch(doc, UPDATE_CONTENT_MODEL, true);
-  if (doc) {
-    nsNodeUtils::AttributeWillChange(frame->GetContent()->AsElement(),
-                                     kNameSpaceID_None,
-                                     nsGkAtoms::frameborder,
-                                     nsIDOMMutationEvent::MODIFICATION);
-  }
-
-  frame->mForceFrameResizability =
-    Preferences::GetBool(kFrameResizePref, frame->mForceFrameResizability);
-
-  frame->RecalculateBorderResize();
-  if (doc) {
-    nsNodeUtils::AttributeChanged(frame->GetContent()->AsElement(),
-                                  kNameSpaceID_None,
-                                  nsGkAtoms::frameborder,
-                                  nsIDOMMutationEvent::MODIFICATION);
-  }
-}
-
 void
 nsHTMLFramesetFrame::Init(nsIContent*       aContent,
                           nsContainerFrame* aParent,
                           nsIFrame*         aPrevInFlow)
 {
   nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
   // find the highest ancestor that is a frameset
   nsIFrame* parentFrame = GetParent();
@@ -578,46 +545,38 @@ void nsHTMLFramesetFrame::GenerateRowCol
         break;
     }
   }
 }
 
 int32_t nsHTMLFramesetFrame::GetBorderWidth(nsPresContext* aPresContext,
                                             bool aTakeForcingIntoAccount)
 {
-  bool forcing = mForceFrameResizability && aTakeForcingIntoAccount;
-
-  if (!forcing) {
-    nsFrameborder frameborder = GetFrameBorder();
-    if (frameborder == eFrameborder_No) {
-      return 0;
-    }
+  nsFrameborder frameborder = GetFrameBorder();
+  if (frameborder == eFrameborder_No) {
+    return 0;
   }
   nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(mContent);
 
   if (content) {
     const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::border);
     if (attr) {
       int32_t intVal = 0;
       if (attr->Type() == nsAttrValue::eInteger) {
         intVal = attr->GetIntegerValue();
         if (intVal < 0) {
           intVal = 0;
         }
       }
 
-      if (forcing && intVal == 0) {
-        intVal = DEFAULT_BORDER_WIDTH_PX;
-      }
       return nsPresContext::CSSPixelsToAppUnits(intVal);
     }
   }
 
-  if (mParentBorderWidth > 0 ||
-      (mParentBorderWidth == 0 && !forcing)) {
+  if (mParentBorderWidth >= 0) {
     return mParentBorderWidth;
   }
 
   return nsPresContext::CSSPixelsToAppUnits(DEFAULT_BORDER_WIDTH_PX);
 }
 
 void
 nsHTMLFramesetFrame::GetDesiredSize(nsPresContext*           aPresContext,
@@ -867,21 +826,16 @@ nsHTMLFramesetFrame::Reflow(nsPresContex
   GetDesiredSize(aPresContext, aReflowState, aDesiredSize);
 
   nscoord width  = (aDesiredSize.Width() <= aReflowState.AvailableWidth())
     ? aDesiredSize.Width() : aReflowState.AvailableWidth();
   nscoord height = (aDesiredSize.Height() <= aReflowState.AvailableHeight())
     ? aDesiredSize.Height() : aReflowState.AvailableHeight();
 
   bool firstTime = (GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
-  if (firstTime) {
-    Preferences::RegisterCallback(FrameResizePrefCallback,
-                                  kFrameResizePref, this);
-    mForceFrameResizability = Preferences::GetBool(kFrameResizePref);
-  }
 
   // subtract out the width of all of the potential borders. There are
   // only borders between <frame>s. There are none on the edges (e.g the
   // leftmost <frame> has no left border).
   int32_t borderWidth = GetBorderWidth(aPresContext, true);
 
   width  -= (mNumCols - 1) * borderWidth;
   if (width < 0) width = 0;
@@ -1108,33 +1062,25 @@ nsHTMLFramesetFrame::Reflow(nsPresContex
   }
 
   if (firstTime) {
     nscolor childColor;
     // set the visibility, color, mouse sensitivity of borders
     for (int verX = 0; verX < mNumCols-1; verX++) {
       if (mVerBorders[verX]) {
         mVerBorders[verX]->SetVisibility(verBordersVis[verX]);
-        if (mForceFrameResizability) {
-          mVerBorders[verX]->mVisibilityOverride = true;
-        } else {
-          SetBorderResize(mVerBorders[verX]);
-        }
+        SetBorderResize(mVerBorders[verX]);
         childColor = (NO_COLOR == verBorderColors[verX]) ? borderColor : verBorderColors[verX];
         mVerBorders[verX]->SetColor(childColor);
       }
     }
     for (int horX = 0; horX < mNumRows-1; horX++) {
       if (mHorBorders[horX]) {
         mHorBorders[horX]->SetVisibility(horBordersVis[horX]);
-        if (mForceFrameResizability) {
-          mHorBorders[horX]->mVisibilityOverride = true;
-        } else {
-          SetBorderResize(mHorBorders[horX]);
-        }
+        SetBorderResize(mHorBorders[horX]);
         childColor = (NO_COLOR == horBorderColors[horX]) ? borderColor : horBorderColors[horX];
         mHorBorders[horX]->SetColor(childColor);
       }
     }
 
     delete[] mChildFrameborder;
     delete[] mChildBorderColors;
 
@@ -1225,34 +1171,26 @@ nsHTMLFramesetFrame::RecalculateBorderRe
   PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < INT32_MAX / NS_MAX_FRAMESET_SPEC_COUNT);
   PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT
                    < UINT_MAX / sizeof(int32_t) / NS_MAX_FRAMESET_SPEC_COUNT);
   // set the visibility and mouse sensitivity of borders
   int32_t verX;
   for (verX = 0; verX < mNumCols-1; verX++) {
     if (mVerBorders[verX]) {
       mVerBorders[verX]->mCanResize = true;
-      if (mForceFrameResizability) {
-        mVerBorders[verX]->mVisibilityOverride = true;
-      } else {
-        mVerBorders[verX]->mVisibilityOverride = false;
-        SetBorderResize(mVerBorders[verX]);
-      }
+      mVerBorders[verX]->mVisibilityOverride = false;
+      SetBorderResize(mVerBorders[verX]);
     }
   }
   int32_t horX;
   for (horX = 0; horX < mNumRows-1; horX++) {
     if (mHorBorders[horX]) {
       mHorBorders[horX]->mCanResize = true;
-      if (mForceFrameResizability) {
-        mHorBorders[horX]->mVisibilityOverride = true;
-      } else {
-        mHorBorders[horX]->mVisibilityOverride = false;
-        SetBorderResize(mHorBorders[horX]);
-      }
+      mHorBorders[horX]->mVisibilityOverride = false;
+      SetBorderResize(mHorBorders[horX]);
     }
   }
 }
 
 void
 nsHTMLFramesetFrame::SetBorderResize(nsHTMLFramesetBorderFrame* aBorderFrame)
 {
   if (aBorderFrame->mVertical) {
--- a/layout/generic/nsFrameSetFrame.h
+++ b/layout/generic/nsFrameSetFrame.h
@@ -182,18 +182,16 @@ protected:
                         nsIntPoint*              aCellIndex = 0);
   
   bool CanResize(bool aVertical, bool aLeft); 
 
   bool CanChildResize(bool aVertical, bool aLeft, int32_t aChildX);
   
   void SetBorderResize(nsHTMLFramesetBorderFrame* aBorderFrame);
 
-  static void FrameResizePrefCallback(const char* aPref, void* aClosure);
-
   nsFramesetDrag   mDrag;
   nsBorderColor    mEdgeColors;
   nsHTMLFramesetBorderFrame* mDragger;
   nsHTMLFramesetFrame* mTopLevelFrameset;
   nsHTMLFramesetBorderFrame** mVerBorders;  // vertical borders
   nsHTMLFramesetBorderFrame** mHorBorders;  // horizontal borders
   nsFrameborder*   mChildFrameborder; // the frameborder attr of children
   nsBorderColor*   mChildBorderColors;
@@ -207,12 +205,11 @@ protected:
   int32_t          mEdgeVisibility;
   nsFrameborder    mParentFrameborder;
   nscolor          mParentBorderColor;
   int32_t          mParentBorderWidth;
   int32_t          mPrevNeighborOrigSize; // used during resize
   int32_t          mNextNeighborOrigSize;
   int32_t          mMinDrag;
   int32_t          mChildCount;
-  bool             mForceFrameResizability;
 };
 
 #endif
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -2177,19 +2177,16 @@ pref("layout.word_select.stop_at_punctua
 //     delete deselects the selection and then deletes word
 // 2 = caret moves to selection edge and is not visible during selection;
 //     word delete deletes the selection (Mac and Linux default)
 // 3 = caret moves and blinks as when there is no selection; word delete
 //     deletes the selection
 // Windows default is 1 for word delete behavior, the rest as for 2.
 pref("layout.selection.caret_style", 0);
 
-// pref to force frames to be resizable
-pref("layout.frames.force_resizability", false);
-
 // pref to report CSS errors to the error console
 pref("layout.css.report_errors", true);
 
 // Should the :visited selector ever match (otherwise :link matches instead)?
 pref("layout.css.visited_links_enabled", true);
 
 // Override DPI. A value of -1 means use the maximum of 96 and the system DPI.
 // A value of 0 means use the system DPI. A positive value is used as the DPI.