From c8ae7cd52995312c30067bcdf5cb7ec3402ecfde Mon Sep 17 00:00:00 2001 From: Andriy Zui Date: Wed, 28 Mar 2012 21:00:14 -0400 Subject: [PATCH] Bug 729924 - maction: statusline actiontype should use the second child as a message. r=karlt --- layout/mathml/nsMathMLmactionFrame.cpp | 32 ++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/layout/mathml/nsMathMLmactionFrame.cpp b/layout/mathml/nsMathMLmactionFrame.cpp index 94e3de745063..0b895387869a 100644 --- a/layout/mathml/nsMathMLmactionFrame.cpp +++ b/layout/mathml/nsMathMLmactionFrame.cpp @@ -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); } } }