Backout Bug 749044 due to Android reftest failures
authorRyan VanderMeulen <ryanvm@gmail.com>
Sat, 09 Jun 2012 16:03:31 -0400
changeset 101086 9373ecc2dd0d109f3cb768e5e34b64c154bf97d9
parent 101085 cd714857c954668fc23887e9ce54b948b71057e8
child 101087 d168da99e94727db6eb77a7810e00518457ed1d7
push id1316
push userakeybl@mozilla.com
push dateMon, 27 Aug 2012 22:37:00 +0000
treeherdermozilla-beta@db4b09302ee2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs749044
milestone16.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
Backout Bug 749044 due to Android reftest failures
layout/mathml/nsMathMLmactionFrame.cpp
layout/mathml/nsMathMLmactionFrame.h
layout/reftests/mathml/maction-dynamic-3-ref.html
layout/reftests/mathml/maction-dynamic-3.html
layout/reftests/mathml/reftest.list
--- a/layout/mathml/nsMathMLmactionFrame.cpp
+++ b/layout/mathml/nsMathMLmactionFrame.cpp
@@ -27,51 +27,39 @@
 #include "nsStyleSet.h"
 #include "nsDisplayList.h"
 #include "nsContentUtils.h"
 
 //
 // <maction> -- bind actions to a subexpression - implementation
 //
 
-enum nsMactionActionTypes {
-  NS_MATHML_ACTION_TYPE_CLASS_ERROR            = 0x10,
-  NS_MATHML_ACTION_TYPE_CLASS_USE_SELECTION    = 0x20,
-  NS_MATHML_ACTION_TYPE_CLASS_IGNORE_SELECTION = 0x40,
-  NS_MATHML_ACTION_TYPE_CLASS_BITMASK          = 0xF0,
-
-  NS_MATHML_ACTION_TYPE_NONE       = NS_MATHML_ACTION_TYPE_CLASS_ERROR|0x01,
-
-  NS_MATHML_ACTION_TYPE_TOGGLE     = NS_MATHML_ACTION_TYPE_CLASS_USE_SELECTION|0x01,
-  NS_MATHML_ACTION_TYPE_UNKNOWN    = NS_MATHML_ACTION_TYPE_CLASS_USE_SELECTION|0x02,
-
-  NS_MATHML_ACTION_TYPE_STATUSLINE = NS_MATHML_ACTION_TYPE_CLASS_IGNORE_SELECTION|0x01,
-  NS_MATHML_ACTION_TYPE_TOOLTIP    = NS_MATHML_ACTION_TYPE_CLASS_IGNORE_SELECTION|0x02
-};
+#define NS_MATHML_ACTION_TYPE_NONE         0
+#define NS_MATHML_ACTION_TYPE_TOGGLE       1
+#define NS_MATHML_ACTION_TYPE_STATUSLINE   2
+#define NS_MATHML_ACTION_TYPE_TOOLTIP      3 // unsupported
 
 
 // helper function to parse actiontype attribute
 static PRInt32
 GetActionType(nsIContent* aContent)
 {
   nsAutoString value;
 
-  if (aContent) {
-    if (!aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::actiontype_, value))
-      return NS_MATHML_ACTION_TYPE_NONE; 
-  }
+  if (aContent)
+    aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::actiontype_, value);
 
   if (value.EqualsLiteral("toggle"))
     return NS_MATHML_ACTION_TYPE_TOGGLE;
   if (value.EqualsLiteral("statusline"))
     return NS_MATHML_ACTION_TYPE_STATUSLINE;
   if (value.EqualsLiteral("tooltip"))
     return NS_MATHML_ACTION_TYPE_TOOLTIP;
 
-  return NS_MATHML_ACTION_TYPE_UNKNOWN;
+  return NS_MATHML_ACTION_TYPE_NONE;
 }
 
 nsIFrame*
 NS_NewMathMLmactionFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
   return new (aPresShell) nsMathMLmactionFrame(aContext);
 }
 
@@ -142,28 +130,18 @@ nsMathMLmactionFrame::ChildListChanged(P
 
 // return the frame whose number is given by the attribute selection="number"
 nsIFrame* 
 nsMathMLmactionFrame::GetSelectedFrame()
 {
   nsAutoString value;
   PRInt32 selection; 
 
-  if ((mActionType & NS_MATHML_ACTION_TYPE_CLASS_BITMASK) == 
-       NS_MATHML_ACTION_TYPE_CLASS_ERROR) {
-    // Mark mSelection as an error.
-    mSelection = -1;
-    mSelectedFrame = nsnull;
-    return mSelectedFrame;
-  }
-
-  // Selection is not applied to tooltip and statusline.
-  // Thereby return the first child.
-  if ((mActionType & NS_MATHML_ACTION_TYPE_CLASS_BITMASK) == 
-       NS_MATHML_ACTION_TYPE_CLASS_IGNORE_SELECTION) {
+  // selection is applied only to toggle, return first child otherwise
+  if (NS_MATHML_ACTION_TYPE_TOGGLE != mActionType) {
     // We don't touch mChildCount here. It's incorrect to assign it 1,
     // and it's inefficient to count the children. It's fine to leave
     // it be equal -1 because it's not used with other actiontypes.
     mSelection = 1;
     mSelectedFrame = mFrames.FirstChild();
     return mSelectedFrame;
   }
 
@@ -174,18 +152,18 @@ nsMathMLmactionFrame::GetSelectedFrame()
     selection = value.ToInteger(&errorCode);
     if (NS_FAILED(errorCode)) 
       selection = 1;
   }
   else selection = 1; // default is first frame
 
   if (-1 != mChildCount) { // we have been in this function before...
     // cater for invalid user-supplied selection
-    if (selection > mChildCount || selection < 1)
-      selection = -1;
+    if (selection > mChildCount || selection < 1) 
+      selection = 1;
     // quick return if it is identical with our cache
     if (selection == mSelection) 
       return mSelectedFrame;
   }
 
   // get the selected child and cache new values...
   PRInt32 count = 0;
   nsIFrame* childFrame = mFrames.FirstChild();
@@ -193,18 +171,18 @@ nsMathMLmactionFrame::GetSelectedFrame()
     if (!mSelectedFrame) 
       mSelectedFrame = childFrame; // default is first child
     if (++count == selection) 
       mSelectedFrame = childFrame;
 
     childFrame = childFrame->GetNextSibling();
   }
   // cater for invalid user-supplied selection
-  if (selection > count || selection < 1)
-    selection = -1;
+  if (selection > count || selection < 1) 
+    selection = 1;
 
   mChildCount = count;
   mSelection = selection;
   TransmitAutomaticData();
 
   return mSelectedFrame;
 }
 
@@ -240,24 +218,26 @@ nsMathMLmactionFrame::AttributeChanged(P
 {
   bool needsReflow = false;
 
   if (aAttribute == nsGkAtoms::actiontype_) {
     // updating mActionType ...
     PRInt32 oldActionType = mActionType;
     mActionType = GetActionType(mContent);
 
-    // Initiate a reflow when actiontype classes are different.
-    if ((oldActionType & NS_MATHML_ACTION_TYPE_CLASS_BITMASK) !=
-          (mActionType & NS_MATHML_ACTION_TYPE_CLASS_BITMASK)) {
+    // We have to initiate a reflow only when changing actiontype
+    // from toggle or to toggle.
+    if (oldActionType == NS_MATHML_ACTION_TYPE_TOGGLE || 
+          mActionType == NS_MATHML_ACTION_TYPE_TOGGLE) {
       needsReflow = true;
     }
   } else if (aAttribute == nsGkAtoms::selection_) {
-    if ((mActionType & NS_MATHML_ACTION_TYPE_CLASS_BITMASK) == 
-         NS_MATHML_ACTION_TYPE_CLASS_USE_SELECTION) {
+    // When the selection attribute is changed we have to initiate a reflow
+    // only when actiontype is toggle.
+    if (NS_MATHML_ACTION_TYPE_TOGGLE == mActionType) {
       needsReflow = true;
     }
   } else {
     // let the base class handle other attribute changes
     return 
       nsMathMLContainerFrame::AttributeChanged(aNameSpaceID, 
                                                aAttribute, aModType);
   }
@@ -271,23 +251,16 @@ nsMathMLmactionFrame::AttributeChanged(P
 }
 
 //  Only paint the selected child...
 NS_IMETHODIMP
 nsMathMLmactionFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                        const nsRect&           aDirtyRect,
                                        const nsDisplayListSet& aLists)
 {
-  // Report an error if something wrong was found in this frame.
-  // We can't call nsDisplayMathMLError from here,
-  // so ask nsMathMLContainerFrame to do the work for us.
-  if (NS_MATHML_HAS_ERROR(mPresentationData.flags)) {
-    return nsMathMLContainerFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists);
-  }
-
   nsresult rv = DisplayBorderBackgroundOutline(aBuilder, aLists);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsIFrame* childFrame = GetSelectedFrame();
   if (childFrame) {
     // Put the child's background directly onto the content list
     nsDisplayListSet set(aLists, aLists.Content());
     // The children should be in content order
@@ -331,25 +304,20 @@ nsMathMLmactionFrame::Reflow(nsPresConte
 }
 
 // Only place the selected child ...
 /* virtual */ nsresult
 nsMathMLmactionFrame::Place(nsRenderingContext& aRenderingContext,
                             bool                 aPlaceOrigin,
                             nsHTMLReflowMetrics& aDesiredSize)
 {
-  nsIFrame* childFrame = GetSelectedFrame();
-
-  if (mSelection == -1) {
-    return ReflowError(aRenderingContext, aDesiredSize);
-  }
-
   aDesiredSize.width = aDesiredSize.height = 0;
   aDesiredSize.ascent = 0;
   mBoundingMetrics = nsBoundingMetrics();
+  nsIFrame* childFrame = GetSelectedFrame();
   if (childFrame) {
     GetReflowAndBoundingMetricsFor(childFrame, aDesiredSize, mBoundingMetrics);
     if (aPlaceOrigin) {
       FinishReflowChild(childFrame, PresContext(), nsnull, aDesiredSize, 0, 0, 0);
     }
     mReference.x = 0;
     mReference.y = aDesiredSize.ascent;
   }
--- a/layout/mathml/nsMathMLmactionFrame.h
+++ b/layout/mathml/nsMathMLmactionFrame.h
@@ -76,16 +76,17 @@ protected:
   
   virtual PRIntn GetSkipSides() const { return 0; }
 
 private:
   PRInt32         mActionType;
   PRInt32         mChildCount;
   PRInt32         mSelection;
   nsIFrame*       mSelectedFrame;
+  nsString        mRestyle;
   nsCOMPtr<MouseListener> mListener;
 
   // helper to return the frame for the attribute selection="number"
   nsIFrame* 
   GetSelectedFrame();
 };
 
 #endif /* nsMathMLmactionFrame_h___ */
deleted file mode 100644
--- a/layout/reftests/mathml/maction-dynamic-3-ref.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>dynamic maction 3</title>
-</head>
-
-<body>
-
-<!-- This element generates an invalid markup error. -->
-<!-- We are assuming here that all invalid MathML markups look the same. -->
-<p><math><msup><mi>x</mi></msup></math></p>
-
-<p><math><mtext>__1__</mtext></math></p>
-
-<p><math><mtext>__1__</mtext></math></p>
-
-<p><math><msup><mi>x</mi></msup></math></p>
-
-<p><math><msup><mi>x</mi></msup></math></p>
-
-<p><math><mtext>__1__</mtext></math></p>
-
-<p><math><mtext>__1__</mtext></math></p>
-
-<p><math><mtext>__1__</mtext></math></p>
-
-<p><math><mtext>__1__</mtext></math></p>
-
-<p><math><mtext>__1__</mtext></math></p>
-
-<p><math><mtext>__1__</mtext></math></p>
-
-<p><math><msup><mi>x</mi></msup></math></p>
-
-</body>
-</html>
deleted file mode 100644
--- a/layout/reftests/mathml/maction-dynamic-3.html
+++ /dev/null
@@ -1,137 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-wait">
-<head>
-<title>dynamic maction 3</title>
-</head>
-
-<body>
-
-<p>
-<math>
-  <maction id="m1" actiontype="toggle">
-    <mtext>__1__</mtext>
-    <mtext>__2__</mtext>
-  </maction>
-</math>
-</p>
-
-<p>
-<math>
-  <maction id="m2" actiontype="toggle" selection="5">
-    <mtext>__1__</mtext>
-    <mtext>__2__</mtext>
-  </maction>
-</math>
-</p>
-
-<p>
-<math>
-  <maction id="m3" actiontype="toggle" selection="5">
-    <mtext>__1__</mtext>
-    <mtext>__2__</mtext>
-  </maction>
-</math>
-</p>
-
-<p>
-<math>
-  <maction id="m4" actiontype="toggle">
-    <mtext>__1__</mtext>
-    <mtext>__2__</mtext>
-  </maction>
-</math>
-</p>
-
-<p>
-<math>
-  <maction id="m5" actiontype="toggle" selection="5">
-    <mtext>__1__</mtext>
-    <mtext>__2__</mtext>
-  </maction>
-</math>
-</p>
-
-<p>
-<math>
-  <maction id="m6" actiontype="toggle">
-    <mtext>__1__</mtext>
-    <mtext>__2__</mtext>
-  </maction>
-</math>
-</p>
-
-<p>
-<math>
-  <maction id="m7">
-    <mtext>__1__</mtext>
-    <mtext>__2__</mtext>
-  </maction>
-</math>
-</p>
-
-<p>
-<math>
-  <maction id="m8" actiontype="unknown_action_type">
-    <mtext>__1__</mtext>
-    <mtext>__2__</mtext>
-  </maction>
-</math>
-</p>
-
-<p>
-<math>
-  <maction id="m9" selection="5">
-    <mtext>__1__</mtext>
-    <mtext>__2__</mtext>
-  </maction>
-</math>
-</p>
-
-<p>
-<math>
-  <maction id="m10" actiontype="unknown_action_type" selection="5">
-    <mtext>__1__</mtext>
-    <mtext>__2__</mtext>
-  </maction>
-</math>
-</p>
-
-<p>
-<math>
-  <maction id="m11" actiontype="statusline">
-    <mtext>__1__</mtext>
-    <mtext>__2__</mtext>
-  </maction>
-</math>
-</p>
-
-<p>
-<math>
-  <maction id="m12" actiontype="statusline" selection="5">
-    <mtext>__1__</mtext>
-    <mtext>__2__</mtext>
-  </maction>
-</math>
-</p>
-
-<script>
-  function doTest() {
-    document.getElementById("m1").setAttribute("selection", "5");
-    document.getElementById("m2").setAttribute("selection", "1");
-    document.getElementById("m3").setAttribute("actiontype", "statusline");
-    document.getElementById("m4").removeAttribute("actiontype");
-    document.getElementById("m5").setAttribute("actiontype", "unknown_action_type");
-    document.getElementById("m6").setAttribute("actiontype", "unknown_action_type");
-    document.getElementById("m7").setAttribute("actiontype", "toggle");
-    document.getElementById("m8").setAttribute("actiontype", "toggle");
-    document.getElementById("m9").setAttribute("actiontype", "statusline");
-    document.getElementById("m10").setAttribute("actiontype", "statusline");
-    document.getElementById("m11").setAttribute("selection", "5");
-    document.getElementById("m12").setAttribute("actiontype", "toggle");
-  
-    document.documentElement.removeAttribute('class');
-  }
-  window.addEventListener("MozReftestInvalidate", doTest, false);
-</script>
-
-</body>
-</html>
--- a/layout/reftests/mathml/reftest.list
+++ b/layout/reftests/mathml/reftest.list
@@ -96,9 +96,8 @@ fails == mstyle-5.xhtml mstyle-5-ref.xht
 != link-1.xhtml link-ref.xhtml
 == munderover-empty-scripts.html munderover-empty-scripts-ref.html
 == positive-namedspace.html positive-namedspace-ref.html
 == mtable-width.html mtable-width-ref.html
 == maction-selection.html maction-selection-ref.html
 == maction-dynamic-embellished-op.html maction-dynamic-embellished-op-ref.html
 == maction-dynamic-1.html maction-dynamic-1-ref.html
 == maction-dynamic-2.html maction-dynamic-2-ref.html
-== maction-dynamic-3.html maction-dynamic-3-ref.html