Skip to content
Browse files

Add patches for bug 662756 + Andrii's experimental patches for bug 54…

…4001
  • Loading branch information...
1 parent 522ecd7 commit 63597a4b01b48e82bcbfd320199329933839ed0b @fred-wang committed Jun 7, 2012
Showing with 322 additions and 12 deletions.
  1. +50 −0 bug-544001-fix-part2.diff
  2. +93 −0 bug-544001-fix.diff
  3. +51 −0 default-lspace-rspace-2.diff
  4. +110 −0 default-lspace-rspace-tests.diff
  5. +5 −2 series
  6. +13 −10 status
View
50 bug-544001-fix-part2.diff
@@ -0,0 +1,50 @@
+# HG changeset patch
+# Parent 05cb34b084e05998c1a181bfa803a870740c293e
+# User Andrii Zui <prazuber@gmail.com>
+b=544001. Something was fixed here.
+
+diff --git a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp
+--- a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp
++++ b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp
+@@ -1096,16 +1096,41 @@ DefaultTooltipTextProvider::GetNodeText(
+ if (titleElement) {
+ titleElement->GetTextContent(outText);
+ if ( outText.Length() )
+ found = true;
+ break;
+ }
+ }
+ }
++ else {
++ if (content->GetNameSpaceID() == kNameSpaceID_MathML &&
++ content->Tag() == nsGkAtoms::maction_) {
++ nsString actionType;
++ currElement->GetAttribute(NS_LITERAL_STRING("actiontype"), actionType);
++ if (actionType.EqualsLiteral("tooltip")) {
++ nsCOMPtr<nsIDOMNode> firstMactionNode;
++ if (currElement->GetFirstChild(getter_AddRefs(firstMactionNode))) {
++ nsCOMPtr<nsIDOMNode> secondMactionNode;
++ if (firstMactionNode->GetNextSibling(getter_AddRefs(secondMactionNode))) {
++ nsCOMPtr<nsIDOMElement> secondMactionElement(do_QueryInterface(secondMactionNode));
++ if (secondMactionElement) {
++ nsCOMPtr<nsIContent> mtextContent(do_QueryInterface(secondMactionElement));
++ if (mtextContent && mtextContent->GetNameSpaceID() == kNameSpaceID_MathML &&
++ mtextContent->Tag() == nsGkAtoms::mtext_) {
++ mtextContent->GetTextContent(outText);
++ if (outText.Length())
++ found = true;
++ }
++ }
++ }
++ }
++ }
++ }
++ }
+ }
+ }
+ }
+ }
+ }
+
+ // not found here, walk up to the parent and keep trying
+ if ( !found ) {
View
93 bug-544001-fix.diff
@@ -0,0 +1,93 @@
+# HG changeset patch
+# Parent 7ad09a45954435bb18a05fda404e357553a7071d
+# User Andrii Zui <prazuber@gmail.com>
+b=544001. MathML tooltip actiontype of maction implemented. r=karlt
+
+diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
+--- a/browser/base/content/browser.js
++++ b/browser/base/content/browser.js
+@@ -3023,37 +3023,40 @@ function FillInHTMLTooltip(tipElement)
+ var retVal = false;
+ // Don't show the tooltip if the tooltip node is a document or disconnected.
+ if (!tipElement.ownerDocument ||
+ (tipElement.ownerDocument.compareDocumentPosition(tipElement) & document.DOCUMENT_POSITION_DISCONNECTED))
+ return retVal;
+
+ const XLinkNS = "http://www.w3.org/1999/xlink";
+ const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
++ const MathMLNS = "http://www.w3.org/1998/Math/MathML";
+
+ var titleText = null;
+ var XLinkTitleText = null;
+ var SVGTitleText = null;
+ var lookingForSVGTitle = true;
++ var MathMLTitleText = null;
+ var direction = tipElement.ownerDocument.dir;
+
+ // If the element is invalid per HTML5 Forms specifications and has no title,
+ // show the constraint validation error message.
+ if ((tipElement instanceof HTMLInputElement ||
+ tipElement instanceof HTMLTextAreaElement ||
+ tipElement instanceof HTMLSelectElement ||
+ tipElement instanceof HTMLButtonElement) &&
+ !tipElement.hasAttribute('title') &&
+ (!tipElement.form || !tipElement.form.noValidate)) {
+ // If the element is barred from constraint validation or valid,
+ // the validation message will be the empty string.
+ titleText = tipElement.validationMessage;
+ }
+
+- while (!titleText && !XLinkTitleText && !SVGTitleText && tipElement) {
++ while (!titleText && !XLinkTitleText && !SVGTitleText &&
++ !MathMLTitleText && tipElement) {
+ if (tipElement.nodeType == Node.ELEMENT_NODE &&
+ tipElement.namespaceURI != XULNS) {
+ titleText = tipElement.getAttribute("title");
+ if ((tipElement instanceof HTMLAnchorElement ||
+ tipElement instanceof HTMLAreaElement ||
+ tipElement instanceof HTMLLinkElement ||
+ tipElement instanceof SVGAElement) && tipElement.href) {
+ XLinkTitleText = tipElement.getAttributeNS(XLinkNS, "title");
+@@ -3068,31 +3071,41 @@ function FillInHTMLTooltip(tipElement)
+ for (let i = 0; i < length; i++) {
+ let childNode = tipElement.childNodes[i];
+ if (childNode instanceof SVGTitleElement) {
+ SVGTitleText = childNode.textContent;
+ break;
+ }
+ }
+ }
++ if (tipElement.nodeName = "maction" && tipElement.namespaceURI == MathMLNS &&
++ tipElement.getAttribute("actiontype") == "tooltip") {
++ var MathMLTooltipNode = tipElement.firstElementChild;
++ if (MathMLTooltipNode) {
++ MathMLTooltipNode = MathMLTooltipNode.nextElementSibling;
++ if (MathMLTooltipNode.nodeName == "mtext" &&
++ MathMLTooltipNode.namespaceURI == MathMLNS)
++ MathMLTitleText = MathMLTooltipNode.textContent;
++ }
++ }
+ var defView = tipElement.ownerDocument.defaultView;
+ // XXX Work around bug 350679:
+ // "Tooltips can be fired in documents with no view".
+ if (!defView)
+ return retVal;
+ direction = defView.getComputedStyle(tipElement, "")
+ .getPropertyValue("direction");
+ }
+ tipElement = tipElement.parentNode;
+ }
+
+ var tipNode = document.getElementById("aHTMLTooltip");
+ tipNode.style.direction = direction;
+
+- [titleText, XLinkTitleText, SVGTitleText].forEach(function (t) {
++ [titleText, XLinkTitleText, SVGTitleText, MathMLTitleText].forEach(function (t) {
+ if (t && /\S/.test(t)) {
+ // Make CRLF and CR render one line break each.
+ t = t.replace(/\r\n?/g, '\n');
+
+ tipNode.setAttribute("label", t);
+ retVal = true;
+ }
+ });
View
51 default-lspace-rspace-2.diff
@@ -0,0 +1,51 @@
+# HG changeset patch
+# Parent dd6ec482a85d234420a5d8beb3f410b318e03c55
+# User Frédéric Wang <fred.wang@free.fr>
+Bug 662756 - The default value for attributes lspace/rspace of <mo> should be thickmathspace. r=karlt
+
+diff --git a/layout/mathml/nsMathMLmoFrame.cpp b/layout/mathml/nsMathMLmoFrame.cpp
+--- a/layout/mathml/nsMathMLmoFrame.cpp
++++ b/layout/mathml/nsMathMLmoFrame.cpp
+@@ -334,24 +334,34 @@ nsMathMLmoFrame::ProcessOperatorData()
+ if (!prevSibling && nextSibling)
+ form = NS_MATHML_OPERATOR_FORM_PREFIX;
+ else if (prevSibling && !nextSibling)
+ form = NS_MATHML_OPERATOR_FORM_POSTFIX;
+ }
+ mFlags &= ~NS_MATHML_OPERATOR_FORM; // clear the old form bits
+ mFlags |= form;
+
+- // lookup the operator dictionary
+- float lspace = 0.0f;
+- float rspace = 0.0f;
+- nsAutoString data;
+- mMathMLChar.GetData(data);
+- bool found = nsMathMLOperators::LookupOperator(data, form, &mFlags, &lspace, &rspace);
+- if (found && (lspace || rspace)) {
+- // cache the default values of lspace & rspace that we get from the dictionary.
++ // Use the default value suggested by the MathML REC.
++ // http://www.w3.org/TR/MathML/chapter3.html#presm.mo.attrs
++ // thickmathspace = 5/18em
++ float lspace = 5.0/18.0;
++ float rspace = 5.0/18.0;
++ if (NS_MATHML_OPERATOR_IS_INVISIBLE(mFlags)) {
++ // mMathMLChar has been reset in ProcessTextData so we can not find it
++ // in the operator dictionary. The operator dictionary always uses
++ // lspace = rspace = 0 for invisible operators.
++ lspace = rspace = 0.0;
++ } else {
++ // lookup the operator dictionary
++ nsAutoString data;
++ mMathMLChar.GetData(data);
++ nsMathMLOperators::LookupOperator(data, form, &mFlags, &lspace, &rspace);
++ }
++ if (lspace || rspace) {
++ // Cache the default values of lspace and rspace.
+ // since these values are relative to the 'em' unit, convert to twips now
+ nscoord em;
+ nsRefPtr<nsFontMetrics> fm;
+ nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
+ GetEmHeight(fm, em);
+
+ mEmbellishData.leadingSpace = NSToCoordRound(lspace * em);
+ mEmbellishData.trailingSpace = NSToCoordRound(rspace * em);
View
110 default-lspace-rspace-tests.diff
@@ -0,0 +1,110 @@
+# HG changeset patch
+# Parent b6a68c056fc843e938b4c8d23c926856300ca81a
+# User Frédéric Wang <fred.wang@free.fr>
+Reftest for bug 662756. r=karlt
+
+diff --git a/layout/reftests/mathml/mo-lspace-rspace-ref.html b/layout/reftests/mathml/mo-lspace-rspace-ref.html
+new file mode 100644
+--- /dev/null
++++ b/layout/reftests/mathml/mo-lspace-rspace-ref.html
+@@ -0,0 +1,43 @@
++<!-- -*- mode: HTML; tab-width: 2; indent-tabs-mode: nil; -*- -->
++<!-- vim: set tabstop=2 expandtab shiftwidth=2 textwidth=80: -->
++<!DOCTYPE html>
++<html>
++ <head>
++ <title>mo-lspace-rspace</title>
++ </head>
++
++ <body>
++
++ <p>
++ <!-- not in the operator dictionary -->
++ <math>
++ <mtext>_</mtext>
++ <mspace width="thickmathspace" height="0" depth="0"></mspace>
++ <mtext>MO</mtext>
++ <mspace width="thickmathspace" height="0" depth="0"></mspace>
++ <mtext>_</mtext>
++ </math>
++ </p>
++
++ <p>
++ <!-- operator.\u223F.infix = lspace:3 rspace:3 # sine wave -->
++ <math>
++ <mtext>_</mtext>
++ <mspace width="thinmathspace" height="0" depth="0"></mspace>
++ <mtext>&#x0223F;</mtext>
++ <mspace width="thinmathspace" height="0" depth="0"></mspace>
++ <mtext>_</mtext>
++ </math>
++ </p>
++
++ <p>
++ <!-- Invisible operator -->
++ <math>
++ <mtext>_</mtext>
++ <mtext>&#x02061;</mtext>
++ <mtext>_</mtext>
++ </math>
++ </p>
++
++ </body>
++</html>
+diff --git a/layout/reftests/mathml/mo-lspace-rspace.html b/layout/reftests/mathml/mo-lspace-rspace.html
+new file mode 100644
+--- /dev/null
++++ b/layout/reftests/mathml/mo-lspace-rspace.html
+@@ -0,0 +1,39 @@
++<!-- -*- mode: HTML; tab-width: 2; indent-tabs-mode: nil; -*- -->
++<!-- vim: set tabstop=2 expandtab shiftwidth=2 textwidth=80: -->
++<!DOCTYPE html>
++<html>
++ <head>
++ <title>mo-lspace-rspace</title>
++ </head>
++
++ <body>
++
++ <p>
++ <!-- not in the operator dictionary -->
++ <math>
++ <mtext>_</mtext>
++ <mo>MO</mo>
++ <mtext>_</mtext>
++ </math>
++ </p>
++
++ <p>
++ <!-- operator.\u223F.infix = lspace:3 rspace:3 # sine wave -->
++ <math>
++ <mtext>_</mtext>
++ <mo>&#x0223F;</mo>
++ <mtext>_</mtext>
++ </math>
++ </p>
++
++ <p>
++ <!-- Invisible operator -->
++ <math>
++ <mtext>_</mtext>
++ <mo>&#x02061;</mo>
++ <mtext>_</mtext>
++ </math>
++ </p>
++
++ </body>
++</html>
+diff --git a/layout/reftests/mathml/reftest.list b/layout/reftests/mathml/reftest.list
+--- a/layout/reftests/mathml/reftest.list
++++ b/layout/reftests/mathml/reftest.list
+@@ -96,8 +96,9 @@ fails == mstyle-5.xhtml mstyle-5-ref.xht
+ != link-1.xhtml link-ref.xhtml
+ == munderover-empty-scripts.html munderover-empty-scripts-ref.html
+ == positive-namedspace.html positive-namedspace-ref.html
+ == mtable-width.html mtable-width-ref.html
+ == maction-selection.html maction-selection-ref.html
+ == maction-dynamic-embellished-op.html maction-dynamic-embellished-op-ref.html
+ == maction-dynamic-1.html maction-dynamic-1-ref.html
+ == maction-dynamic-2.html maction-dynamic-2-ref.html
++== mo-lspace-rspace.html mo-lspace-rspace-ref.html
View
7 series
@@ -1,13 +1,16 @@
-remove-namedspace-atoms.diff
+bug-544001-fix-part2.diff
+bug-544001-fix.diff
+default-lspace-rspace-2.diff
+default-lspace-rspace-tests.diff
download-fonts-1.diff
download-fonts-2.diff
-remove-stix-beta.diff
mglyph-1.diff
mglyph-2.diff
mglyph-3.diff
ms-quotes-1.diff
ms-quotes-2.diff
ms-quotes-3.diff
+remove-stix-beta.diff
try.diff
largeop-initial-stretch.diff
opdict-diagonal-arrows.diff
View
23 status
@@ -1,10 +1,13 @@
-e669fe43918abd722b893eb88e522140dda2ebec:remove-namedspace-atoms.diff
-f919433edf0d4b9fdc2cc92fdaa19e8e9f39f630:download-fonts-1.diff
-7ec8d5a9a1f966e2f1dd9cb2d1a4222d81c3f07c:download-fonts-2.diff
-162437a551dd8157043ae88ba76b1320873efdaf:remove-stix-beta.diff
-cd784e453c54bd9b63db958618de346fb6e03f9b:mglyph-1.diff
-b8d320249fd26c4af511cf2e249e74f0b8c517d1:mglyph-2.diff
-5383f1487177c31e00e791576b613c984b490305:mglyph-3.diff
-9e07cae022b0ef390398e95ccfda522c9673dd5f:ms-quotes-1.diff
-ba8c99eef575141b53f0a5ded84a30354ce6fd3f:ms-quotes-2.diff
-6ebabe11ac46b0e0c0ca9a0cf15f8301b9effd54:ms-quotes-3.diff
+1042777b301f54e4a4f960d1de9c0bd10f8fd0cb:bug-544001-fix-part2.diff
+bb1f512258aab315b55e1d708a53d0dab09af973:bug-544001-fix.diff
+8026d8623fa28c80a6a09c07250b307aca123711:default-lspace-rspace-2.diff
+c60e7aedafa114fec5812d9e6d2963a15a1c85e3:default-lspace-rspace-tests.diff
+d31692cdf84db63288d1b137af1f51a0503d4793:download-fonts-1.diff
+441cd8078e0a5b4aaf5d82771a891ea70639126c:download-fonts-2.diff
+5f835db9163b7440b58f21d571422031f3267605:mglyph-1.diff
+0e8f08127778f05db696b048bb7f50f0be14c384:mglyph-2.diff
+66a9ccc3b3e9670c397de8e43101da1c35a13668:mglyph-3.diff
+1768d3d435b34a54c7151d6b21da1c01aeaf4efd:ms-quotes-1.diff
+6e3c4e2d3723a5ec1a0e046f3be0d6a96b5fcdf1:ms-quotes-2.diff
+1b3845142592bd99446f96521177e64b39a19d16:ms-quotes-3.diff
+182e9a125be5e3dd6a17a280fff94264d446547c:remove-stix-beta.diff

0 comments on commit 63597a4

Please sign in to comment.
Something went wrong with that request. Please try again.