Bug 729924 - statusline actiontype should use the second child as a message. r=karlt
authorAndriy Zui <PraZuBeR@gmail.com>
Thu, 29 Mar 2012 11:50:02 +0200
changeset 90606 d3cc19901240f812a2a5afd0a8e9cb601311d496
parent 90605 76d72796ceeea36db202b27966d3281f56f9b6b4
child 90607 ff3521bc655946ec545b49bc64bc7167de8ee709
child 90623 1001d5a9f57a4b92d7dba13e13ecc04442f47ef4
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 - 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