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

This commit is contained in:
Andriy Zui 2012-03-28 21:00:14 -04:00
Родитель 012b498c6b
Коммит c8ae7cd529
1 изменённых файлов: 23 добавлений и 9 удалений

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

@ -122,11 +122,9 @@ nsMathMLmactionFrame::Init(nsIContent* aContent,
} }
if (NS_MATHML_ACTION_TYPE_NONE == mActionType) { if (NS_MATHML_ACTION_TYPE_NONE == mActionType) {
// expected statusline prefix (11ch)... if (value.EqualsLiteral("statusline"))
if (11 < value.Length() && 0 == value.Find("statusline#"))
mActionType = NS_MATHML_ACTION_TYPE_STATUSLINE; mActionType = NS_MATHML_ACTION_TYPE_STATUSLINE;
} }
} }
// Let the base class do the rest // Let the base class do the rest
@ -368,12 +366,28 @@ nsMathMLmactionFrame::MouseOver()
{ {
// see if we should display a status message // see if we should display a status message
if (NS_MATHML_ACTION_TYPE_STATUSLINE == mActionType) { if (NS_MATHML_ACTION_TYPE_STATUSLINE == mActionType) {
nsAutoString value; // retrieve content from a second child if it exists
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::actiontype_, value); nsIFrame* childFrame = mFrames.FrameAt(1);
// expected statusline prefix (11ch)... if (!childFrame) return;
if (11 < value.Length() && 0 == value.Find("statusline#")) {
value.Cut(0, 11); nsIContent* content = childFrame->GetContent();
ShowStatus(PresContext(), value); 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);
} }
} }
} }