Closed
Bug 975747
Opened 11 years ago
Closed 11 years ago
Convert gOperatorTable to a modern hashtable
Categories
(Core :: MathML, defect, P4)
Core
MathML
Tracking
()
RESOLVED
FIXED
mozilla31
People
(Reporter: mccr8, Assigned: anujagarwal464)
References
Details
Attachments
(2 files, 5 obsolete files)
|
3.45 KB,
patch
|
karlt
:
review+
|
Details | Diff | Splinter Review |
|
11.86 KB,
patch
|
fredw
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Updated•11 years ago
|
Priority: -- → P4
| Reporter | ||
Updated•11 years ago
|
Assignee: nobody → anujagarwal464
| Reporter | ||
Comment 1•11 years ago
|
||
Let me know if you have any questions!
| Assignee | ||
Comment 2•11 years ago
|
||
Is this ok?
Do I remove full nsHashtable.h?
Attachment #8391377 -
Flags: feedback?(continuation)
| Reporter | ||
Comment 3•11 years ago
|
||
Comment on attachment 8391377 [details] [diff] [review]
removed old hashtable from nsMathMLOperator.cpp
Review of attachment 8391377 [details] [diff] [review]:
-----------------------------------------------------------------
This looks good to me, aside from the two minor issues I listed.
"Do I remove full nsHashtable.h?"
If you mean the #include, yes, you should remove the include of nsHashtable.h, assuming it compiles.
You should also run the MathML tests locally to make sure everything passes. I think you want to run these two sets of tests:
./mach mochitest-plain layout/mathml/tests/
./mach crashtest layout/mathml/crashtests/
::: layout/mathml/nsMathMLOperators.cpp
@@ +9,2 @@
> #include "nsTArray.h"
> +#include "nsHashKeys.h"
this should probably go before nsTArray.h, so the list is alphabetical, aside from nsMathMLOperators.h, which should remain first.
@@ +331,5 @@
> GetOperatorData(const nsString& aOperator, nsOperatorFlags aForm)
> {
> nsAutoString key(aOperator);
> key.AppendInt(aForm);
> + return (OperatorData*)gOperatorTable->Get(key);
You don't need the (OperatorData*) cast any more.
Attachment #8391377 -
Flags: feedback?(continuation) → feedback+
| Assignee | ||
Comment 4•11 years ago
|
||
./mach mochitest-plain layout/mathml/tests/
All test passed.
./mach crashtest layout/mathml/crashtests/
All test passed.
Attachment #8391399 -
Flags: review?(continuation)
Comment 5•11 years ago
|
||
(In reply to Anuj Agarwal [:anujagarwal464] from comment #4)
> Created attachment 8391399 [details] [diff] [review]
> bug975747.diff
>
> ./mach mochitest-plain layout/mathml/tests/
>
> All test passed.
>
> ./mach crashtest layout/mathml/crashtests/
>
> All test passed.
You'll need to run layout/reftests/mathml/ too. I think it would be good to have one test for each operator property as I'm not sure we cover everything in the test suite http://www.w3.org/TR/MathML3/appendixc.html#oper-dict.index.
| Assignee | ||
Comment 6•11 years ago
|
||
(In reply to Frédéric Wang (:fredw) from comment #5)
mach reftest layout/mathml/crashtests/
All test passed.
| Assignee | ||
Comment 7•11 years ago
|
||
(In reply to Frédéric Wang (:fredw) from comment #5)
sorry!
mach reftest layout/reftests/mathml/
All test passed.
| Reporter | ||
Comment 8•11 years ago
|
||
Comment on attachment 8391399 [details] [diff] [review]
bug975747.diff
Review of attachment 8391399 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks for the patch! This looks good to me, but a MathML peer should review it.
Attachment #8391399 -
Flags: review?(continuation) → review?(karlt)
Comment 9•11 years ago
|
||
(In reply to Anuj Agarwal [:anujagarwal464] from comment #7)
> (In reply to Frédéric Wang (:fredw) from comment #5)
>
> sorry!
>
> mach reftest layout/reftests/mathml/
>
> All test passed.
So the typical ideas for new reftests would be to compare the rendering of operators with and without explicit attribute. The values in the dictionary should be different from the default for
operators that are not in the dictionary (http://www.w3.org/TR/MathML3/chapter3.html#presm.mo.attrs, http://www.w3.org/TR/MathML3/appendixc.html#oper-dict.entries-table). So for example to test lspace/rspace, write a reftest to compare
_<math><mrow><mo form="infix">:</mo></mrow></math>_
against
_<math><mrow><mo form="infix" lspace="veryverythinmathspace" rspace="verythinmathspace">:</mo></mrow></math>_
You can do the same for other operator+infix entries as well as various mo attributes that have a visual effect (stretchy, symmetric, largeop, movablelimits, accent).
Comment 10•11 years ago
|
||
(In reply to Frédéric Wang (:fredw) from comment #9)
> operator+infix entries
I meant operator+form
| Reporter | ||
Comment 11•11 years ago
|
||
This is just a simple data structure replacement. I don't think we need all new tests here.
| Reporter | ||
Comment 12•11 years ago
|
||
| Assignee | ||
Comment 13•11 years ago
|
||
Attachment #8391859 -
Flags: feedback?(fred.wang)
Comment 14•11 years ago
|
||
Comment on attachment 8391859 [details] [diff] [review]
reftest for operator dictionay
Review of attachment 8391859 [details] [diff] [review]:
-----------------------------------------------------------------
I think op-dict-8 ... op-dict-9 can only be one == test that verifies both lspace and rspace at the same time (perhaps for several operators). However "->" is an operator with multiple characters and I don't think our opdict support that at the moment, so please use another operator.
Similarly for op-dict-10, please use another operator that is only made of a single char.
::: layout/reftests/mathml/op-dict-10-ref.html
@@ +5,5 @@
> +</head>
> +<body>
> + <math>
> + <mrow>
> + <mi>x</mi><mo lspace="veryverythinmathspace"rspace="veryverythickmathspace">-></mo><mi>y</mi>
invalid markup. there should be a space between the attributes.
::: layout/reftests/mathml/op-dict-13.html
@@ +6,5 @@
> +</head>
> +<body>
> + <math displaystyle="true">
> + <munder>
> + <mo movablelimits="false">∑</mo>
I guess you mean to remove that attribute?
::: layout/reftests/mathml/op-dict-6-ref.html
@@ +3,5 @@
> +<head>
> + <title>op-dict largeop</title>
> +</head>
> +<body>
> + <math>
I think you want to add the displaystyle attribute as in the op-dict-6 and make this a != reftest. The == one for largeop is already op-dict-7
Attachment #8391859 -
Flags: feedback?(fred.wang) → feedback+
| Assignee | ||
Comment 15•11 years ago
|
||
Attachment #8391859 -
Attachment is obsolete: true
Attachment #8391922 -
Flags: review?(fred.wang)
Comment 16•11 years ago
|
||
Comment on attachment 8391922 [details] [diff] [review]
reftest for operator dictionary
Review of attachment 8391922 [details] [diff] [review]:
-----------------------------------------------------------------
So if I understand the logic of your tests, each attribute has an != test (to check that the attribute has an effect) and an == test (to test that the value is really picked from the operator dictionary). So
- op-dict-11 should be an == test to test that the op dict value movablelimits="true" is picked from the dictionary.
- there should be an == test for accent to verify the op dict value accent="true" is picked from the dictionary (op-dict-11 is the corresponding != test)
- op-dict-8 should be an == test with the op dict value for lspace/rspace (and op-dict-9 is the corresponding != test). Howevever, ⊢ is again a poor choice, because the lspace/rspace value in the operator dictionary are thickmathspace/thickmathspace which are the same as the default for operators that are not in the dictionary.
Updated•11 years ago
|
Attachment #8391399 -
Flags: review?(karlt) → review+
| Assignee | ||
Comment 17•11 years ago
|
||
Attachment #8391922 -
Attachment is obsolete: true
Attachment #8391922 -
Flags: review?(fred.wang)
Attachment #8392256 -
Flags: review?(fred.wang)
Comment 18•11 years ago
|
||
Comment on attachment 8392256 [details] [diff] [review]
reftest for operator dictionary
Review of attachment 8392256 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks that looks good with a minor comment below.
::: layout/reftests/mathml/op-dict-8-ref.html
@@ +5,5 @@
> +</head>
> +<body>
> + <math>
> + <mrow>
> + <mo lspace="verythinmathspace">∀</mo>
The value of ∀ in the operator dictionary is lspace="verythinmathspace" rspace="veryverythinmathspace". I think for op-dict-8 and op-dict-9, you should write
<math><mrow><mi>x</mi><mo form="prefix" ...>∀</mo><mi>y</mi></mrow></math>
so that the spacing around the <mo> will really be visible. At the moment, rspace is not tested since there is nothing on the right of the <mo>.
Attachment #8392256 -
Flags: review?(fred.wang) → review+
| Reporter | ||
Comment 19•11 years ago
|
||
I'll do a try run with the updated test and then land these patches.
| Reporter | ||
Updated•11 years ago
|
Attachment #8391377 -
Attachment is obsolete: true
| Assignee | ||
Comment 20•11 years ago
|
||
@fredw: Thanks for helping in writing reftests.
Attachment #8392348 -
Flags: review?(fred.wang)
| Reporter | ||
Comment 21•11 years ago
|
||
Anuj, I noticed that your new test files are using DOS line endings. You should set your editor to use Unix line endings instead. It looks like there are also some tabs or something in there which are good to avoid.
Also, when you upload a patch, the patch subject or whatever it is called should have a format that looks kind of like
Bug 975747 - Reftest for MathML operator dictionary. r=fred.wang
That will make it a little easier for other people to land patches for you. Thanks.
Comment 22•11 years ago
|
||
Comment on attachment 8392348 [details] [diff] [review]
updated tests
Review of attachment 8392348 [details] [diff] [review]:
-----------------------------------------------------------------
> Anuj, I noticed that your new test files are using DOS line endings. You should set your editor to use Unix line endings instead. It looks like there are also some tabs or something in there which are good to avoid.
I don't know if I already gave you this link: https://developer.mozilla.org/en-US/docs/Developer_Guide/Coding_Style?redirectlocale=en-US&redirectslug=Mozilla_Coding_Style_Guide#General_C.2FC.2B.2B_Practices
::: layout/reftests/mathml/op-dict-8-ref.html
@@ +5,5 @@
> +</head>
> +<body>
> + <math>
> + <mrow>
> + <mi>x</mi><mo form="prefix" lspace="verythinmathspace">∀</mo><mi>y</mi>
The rspace attribute value is still missing. This will only test lspace.
Attachment #8392348 -
Flags: review?(fred.wang) → review+
| Assignee | ||
Comment 23•11 years ago
|
||
Attachment #8392256 -
Attachment is obsolete: true
Attachment #8392348 -
Attachment is obsolete: true
Attachment #8392642 -
Flags: review?(fred.wang)
Updated•11 years ago
|
Attachment #8392642 -
Flags: review?(fred.wang) → review+
| Reporter | ||
Comment 24•11 years ago
|
||
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/6c34299a99b1
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/e6bb23cc2294
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/9ac4d459a1bd
Thanks for the patches! This should show up on Nightly in the next day or two.
| Reporter | ||
Comment 25•11 years ago
|
||
Oops, that last one is for another bug ( https://hg.mozilla.org/integration/mozilla-inbound/rev/9ac4d459a1bd )
Comment 26•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/6c34299a99b1
https://hg.mozilla.org/mozilla-central/rev/e6bb23cc2294
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in
before you can comment on or make changes to this bug.
Description
•