Bug 729924 - statusline actiontype should use the second child as a message. r=karlt

This commit is contained in:
Andriy Zui 2012-03-29 11:50:02 +02:00
Родитель c95886072a
Коммит cd021e0284
1 изменённых файлов: 23 добавлений и 9 удалений

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

@ -122,11 +122,9 @@ nsMathMLmactionFrame::Init(nsIContent* aContent,
}
if (NS_MATHML_ACTION_TYPE_NONE == mActionType) {
// expected statusline prefix (11ch)...
if (11 < value.Length() && 0 == value.Find("statusline#"))
if (value.EqualsLiteral("statusline"))
mActionType = NS_MATHML_ACTION_TYPE_STATUSLINE;
}
}
// Let the base class do the rest
@ -368,12 +366,28 @@ nsMathMLmactionFrame::MouseOver()
{
// see if we should display a status message
if (NS_MATHML_ACTION_TYPE_STATUSLINE == mActionType) {
nsAutoString value;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::actiontype_, value);
// expected statusline prefix (11ch)...
if (11 < value.Length() && 0 == value.Find("statusline#")) {
value.Cut(0, 11);
ShowStatus(PresContext(), value);
// retrieve content from a second child if it exists
nsIFrame* childFrame = mFrames.FrameAt(1);
if (!childFrame) return;
nsIContent* content = childFrame->GetContent();
if (!content) return;
// check whether the content is mtext or not
if (content->GetNameSpaceID() == kNameSpaceID_MathML &&
content->Tag() == nsGkAtoms::mtext_) {
// get the text to be displayed
content = content->GetFirstChild();
if (!content) return;
const nsTextFragment* textFrg = content->GetText();
if (!textFrg) return;
nsAutoString text;
textFrg->AppendTo(text);
// collapse whitespaces as listed in REC, section 3.2.6.1
text.CompressWhitespace();
ShowStatus(PresContext(), text);
}
}
}