Backout Bug 749044 due to Android reftest failures

This commit is contained in:
Ryan VanderMeulen 2012-06-09 16:03:31 -04:00
parent 3f31061461
commit d805e1bc72
5 changed files with 22 additions and 226 deletions

View File

@ -32,20 +32,10 @@
// <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
@ -54,10 +44,8 @@ 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;
@ -66,7 +54,7 @@ GetActionType(nsIContent* aContent)
if (value.EqualsLiteral("tooltip"))
return NS_MATHML_ACTION_TYPE_TOOLTIP;
return NS_MATHML_ACTION_TYPE_UNKNOWN;
return NS_MATHML_ACTION_TYPE_NONE;
}
nsIFrame*
@ -147,18 +135,8 @@ 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.
@ -179,8 +157,8 @@ nsMathMLmactionFrame::GetSelectedFrame()
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;
@ -198,8 +176,8 @@ nsMathMLmactionFrame::GetSelectedFrame()
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;
@ -245,14 +223,16 @@ nsMathMLmactionFrame::AttributeChanged(PRInt32 aNameSpaceID,
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 {
@ -276,13 +256,6 @@ 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);
@ -336,15 +309,10 @@ 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) {

View File

@ -81,6 +81,7 @@ private:
PRInt32 mChildCount;
PRInt32 mSelection;
nsIFrame* mSelectedFrame;
nsString mRestyle;
nsCOMPtr<MouseListener> mListener;
// helper to return the frame for the attribute selection="number"

View File

@ -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>

View File

@ -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>

View File

@ -101,4 +101,3 @@ fails == mstyle-5.xhtml mstyle-5-ref.xhtml # See bug 569125#c29
== 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