Bug 729924 - maction: statusline actiontype should use the second child as a message. r=karlt
authorAndriy Zui <PraZuBeR@gmail.com>
Wed, 28 Mar 2012 21:00:14 -0400
changeset 90581 095fd525afa782e7f4c23a7056b1810f512284ee
parent 90580 dcf8929a8115a4a90e673f9dbf5c857857307445
child 90582 9949bb0923030bdaccc2300b71641368e232633c
push id22366
push usermak77@bonardo.net
push dateThu, 29 Mar 2012 15:38:30 +0000
treeherdermozilla-central@ff3521bc6559 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs729924
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 729924 - maction: statusline actiontype should use the second child as a message. r=karlt
layout/mathml/nsMathMLmactionFrame.cpp
--- a/layout/mathml/nsMathMLmactionFrame.cpp
+++ b/layout/mathml/nsMathMLmactionFrame.cpp
@@ -117,21 +117,19 @@ nsMathMLmactionFrame::Init(nsIContent*  
 
     if (NS_MATHML_ACTION_TYPE_NONE == mActionType) {
       // expected tooltip prefix (8ch)...
       if (8 < value.Length() && 0 == value.Find("tooltip#"))
         mActionType = NS_MATHML_ACTION_TYPE_TOOLTIP;
     }
 
     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
   return nsMathMLContainerFrame::Init(aContent, aParent, aPrevInFlow);
 }
 
 NS_IMETHODIMP
 nsMathMLmactionFrame::TransmitAutomaticData() {
@@ -363,22 +361,38 @@ nsMathMLmactionFrame::MouseListener::Han
   return NS_OK;
 }
 
 void
 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);
     }
   }
 }
 
 void
 nsMathMLmactionFrame::MouseOut()
 {
   // see if we should remove the status message