Always post a restyle request if SetTextStyle() indicates it's needed. b=414123 r+sr+a=roc

This commit is contained in:
mats.palmgren@bredband.net 2008-01-26 18:49:47 -08:00
Родитель 10517a2913
Коммит 78c7362b48
7 изменённых файлов: 85 добавлений и 14 удалений

Просмотреть файл

@ -111,7 +111,7 @@ nsMathMLTokenFrame::SetInitialChildList(nsIAtom* aListName,
return rv;
SetQuotes();
ProcessTextData(PR_FALSE);
ProcessTextData();
return rv;
}
@ -212,7 +212,7 @@ nsMathMLTokenFrame::MarkIntrinsicWidthsDirty()
{
// this could be called due to changes in the nsTextFrame beneath us
// when something changed in the text content. So re-process our text
ProcessTextData(PR_TRUE);
ProcessTextData();
nsMathMLContainerFrame::MarkIntrinsicWidthsDirty();
}
@ -232,16 +232,12 @@ nsMathMLTokenFrame::AttributeChanged(PRInt32 aNameSpaceID,
}
void
nsMathMLTokenFrame::ProcessTextData(PRBool aComputeStyleChange)
nsMathMLTokenFrame::ProcessTextData()
{
// see if the style changes from normal to italic or vice-versa
if (!SetTextStyle())
return;
// has changed but it doesn't have to be reflected straightaway
if (!aComputeStyleChange)
return;
// explicitly request a re-resolve to pick up the change of style
PresContext()->PresShell()->FrameConstructor()->
PostRestyleEvent(mContent, eReStyle_Self, NS_STYLE_HINT_NONE);

Просмотреть файл

@ -82,7 +82,7 @@ public:
virtual nsresult
ChildListChanged(PRInt32 aModType)
{
ProcessTextData(PR_TRUE);
ProcessTextData();
return nsMathMLContainerFrame::ChildListChanged(aModType);
}
@ -93,8 +93,7 @@ protected:
virtual PRIntn GetSkipSides() const { return 0; }
// hook to perform MathML-specific actions depending on the tag
virtual void
ProcessTextData(PRBool aComputeStyleChange);
virtual void ProcessTextData();
// helper to set the style of <mi> which has to be italic or normal
// depending on its textual content

Просмотреть файл

@ -153,7 +153,7 @@ nsMathMLmoFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// get the text that we enclose and setup our nsMathMLChar
void
nsMathMLmoFrame::ProcessTextData(PRBool aComputeStyleChange)
nsMathMLmoFrame::ProcessTextData()
{
mFlags = 0;
@ -958,7 +958,7 @@ nsMathMLmoFrame::MarkIntrinsicWidthsDirty()
// from the parent of our outermost embellished container (we ensure
// that we are the core, not just a sibling of the core)
ProcessTextData(PR_FALSE);
ProcessTextData();
nsIFrame* target = this;
nsEmbellishData embellishData;

Просмотреть файл

@ -103,8 +103,7 @@ protected:
float mMaxSize;
// overload the base method so that we can setup our nsMathMLChar
virtual void
ProcessTextData(PRBool aComputeStyleChange);
virtual void ProcessTextData();
// helper to get our 'form' and lookup in the Operator Dictionary to fetch
// our default data that may come from there, and to complete the setup

Просмотреть файл

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:html="http://www.w3.org/1999/xhtml">
<style type="text/css">mn:first-child {font-style:italic;}</style>
<head>
<title>Testcase for bug 414123</title>
</head>
<body>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<msup>
<mn>M</mn>
<mn>2</mn>
</msup>
</math>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<msup>
<mn>M</mn>
<mn>2</mn>
</msup>
</math>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<msup>
<mn>M</mn>
<mn>2</mn>
</msup>
</math>
</body>
</html>

Просмотреть файл

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Testcase for bug 414123</title>
<script>
function boom() {
var t = document.createTextNode('M')
document.getElementById('mi1').appendChild(t);
var mi = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mi");
var mn = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mn");
var msup = document.createElementNS("http://www.w3.org/1998/Math/MathML", "msup");
mi.appendChild(document.createTextNode('M'));
mn.appendChild(document.createTextNode('2'));
msup.appendChild(mi);
msup.appendChild(mn);
document.getElementById('m').appendChild(msup);
}
</script>
</head>
<body onload="boom()">
<math xmlns="http://www.w3.org/1998/Math/MathML">
<msup>
<mi id="mi1"></mi>
<mn>2</mn>
</msup>
</math>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<msup>
<mi>M</mi>
<mn>2</mn>
</msup>
</math>
<math id="m" xmlns="http://www.w3.org/1998/Math/MathML"></math>
</body>
</html>

Просмотреть файл

@ -665,3 +665,4 @@ random == 403134-1.html 403134-1-ref.html # bug 405377
== 411334-1.xml 411334-1-ref.xml
== 413292-1.html 413292-1-ref.html
== 413361-1.html 413361-1-ref.html
== 414123.xhtml 414123-ref.xhtml