Closed
Bug 537916
Opened 15 years ago
Closed 15 years ago
MathML mfenced: Whitespaces in separators are not ignored
Categories
(Core :: MathML, defect)
Core
MathML
Tracking
()
RESOLVED
FIXED
mozilla1.9.3a4
People
(Reporter: fredw, Assigned: wesongathedeveloper)
Details
(Whiteboard: [good first bug])
Attachments
(3 files, 3 obsolete files)
589 bytes,
application/xhtml+xml
|
Details | |
807 bytes,
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
2.28 KB,
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
The MathML REC indicates:
"The value of separators is a sequence of zero or more separator characters (or entity references), optionally separated by whitespace."
In the testcase, the separators should be a comma, semi-comma and a period. Currently, the spaces are treated as separator.
See http://mxr.mozilla.org/mozilla-central/source/layout/mathml/nsMathMLmfencedFrame.cpp#170
Reporter | ||
Updated•15 years ago
|
Whiteboard: [good first bug]
Assignee | ||
Comment 1•15 years ago
|
||
Assignee: nobody → wesongathedeveloper
Status: NEW → ASSIGNED
Attachment #420873 -
Flags: review?(roc)
Reporter | ||
Comment 2•15 years ago
|
||
(In reply to comment #1)
> Created an attachment (id=420873) [details]
> Patch
Thanks.
The MathML REC says "In MathML, as in XML, "whitespace" means simple spaces, tabs, newlines, or carriage returns, i.e., characters with hexadecimal Unicode codes U+0020, U+0009, U+000A, or U+000D, respectively." but I think your code only removes spaces. I think you can simply use nsAutoString::StripWhitespace
BTW, I'm not even sure that what is made for opening/closing fences (value.Trim(" ")) is correct. The REC says "The "opening-fence" and "closing-fence" are arbitrary strings. (Since they are used as the content of mo elements, any whitespace they contain will be trimmed and collapsed as described in Section 2.4.6 Collapsing Whitespace in Input.)"
Assignee | ||
Comment 3•15 years ago
|
||
Definitely didn't look at all the nsAutoString methods...
Attachment #420873 -
Attachment is obsolete: true
Attachment #420907 -
Flags: review?(roc)
Attachment #420873 -
Flags: review?(roc)
Assignee | ||
Comment 4•15 years ago
|
||
(In reply to comment #2)
> BTW, I'm not even sure that what is made for opening/closing fences
> (value.Trim(" ")) is correct. The REC says "The "opening-fence" and
> "closing-fence" are arbitrary strings. (Since they are used as the content of
> mo elements, any whitespace they contain will be trimmed and collapsed as
> described in Section 2.4.6 Collapsing Whitespace in Input.)"
Shouldn't that be Section 2.3.5? So, based on this interpretation we need to ensure opening/closing fence whitespaces are "collapsed" internally in addition to the value.Trim(" ") that we are doing, right?
Reporter | ||
Comment 5•15 years ago
|
||
> Shouldn't that be Section 2.3.5?
2.4.6 is this section:
http://www.w3.org/TR/MathML/chapter2.html#fund.collapse
>So, based on this interpretation we need to
> ensure opening/closing fence whitespaces are "collapsed" internally in addition
> to the value.Trim(" ") that we are doing, right?
Yes, but again I think value.Trim(" ") only eliminates spaces and not other whitespaces (tab, newlines etc).
I don't know all the string functions, but nsAutoString::CompressWhitespace seems to do the job:
https://developer.mozilla.org/En/NsAutoString#CompressWhitespace
Assignee | ||
Comment 6•15 years ago
|
||
(In reply to comment #5)
> > Shouldn't that be Section 2.3.5?
>
> 2.4.6 is this section:
> http://www.w3.org/TR/MathML/chapter2.html#fund.collapse
>
I
Seems we should file this as a separate bug, no?
Reporter | ||
Comment 7•15 years ago
|
||
(In reply to comment #6)
> (In reply to comment #5)
> > > Shouldn't that be Section 2.3.5?
> >
> > 2.4.6 is this section:
> > http://www.w3.org/TR/MathML/chapter2.html#fund.collapse
> >
> I
> Seems we should file this as a separate bug, no?
Yes, probably.
Comment on attachment 420907 [details] [diff] [review]
Patch
Thanks!! How about a test?
Attachment #420907 -
Flags: review?(roc) → review+
Reporter | ||
Comment 9•15 years ago
|
||
(In reply to comment #8)
> (From update of attachment 420907 [details] [diff] [review])
> Thanks!! How about a test?
Attachment 420067 [details] is currently displayed "(a, b ; c d)" without patch applied.
The correct rendering should be "(a, b; c. d)".
Reporter | ||
Comment 10•15 years ago
|
||
(In reply to comment #9)
> (In reply to comment #8)
> > (From update of attachment 420907 [details] [diff] [review] [details])
> > Thanks!! How about a test?
>
> Attachment 420067 [details] is currently displayed "(a, b ; c d)" without patch
> applied.
> The correct rendering should be "(a, b; c. d)".
Saint, are you working on making a reftest or can I make one from attachment 420067 [details]?
Assignee | ||
Comment 11•15 years ago
|
||
Attachment #424443 -
Flags: review?(roc)
Assignee | ||
Comment 12•15 years ago
|
||
(In reply to comment #10)
> Saint, are you working on making a reftest or can I make one from attachment
> 420067?
Sorry for the lag here...
Reporter | ||
Comment 13•15 years ago
|
||
(In reply to comment #11)
> Created an attachment (id=424443) [details]
> RefTest
Thanks. In addition to checking that whitespaces are collapsed, you are testing the equivalence of <mo>'s and separators. I guess the only thing you need for this bug is to compare two <mfenced/>'s with different values for "separators". However, your idea to check the equivalence is good, so maybe we could create many mfence-*.xhtml tests, including one for bug 538965. I will probably open another bug to list some ideas of reftests for mfence, but for the present bug, I suppose the following is enough:
- compare separators="WS;WS" with ";"
- compare separators=",;." and separator=",WS;WS."
where WS are whitespaces that include other characters than spaces (tab, linefeed etc)
Also, I don't believe you need all the header and <p>'s generated by Amaya. Just a minimal tree html->body->math as the other refests do.
Attachment #424443 -
Flags: review?(roc) → review-
Assignee | ||
Comment 15•15 years ago
|
||
What is the best way to handle inserting newlines in content that's added as a patch? I'm getting this odd interaction between the content and the patch format.
Attachment #424443 -
Attachment is obsolete: true
Reporter | ||
Comment 16•15 years ago
|
||
(In reply to comment #15)
> Created an attachment (id=428107) [details]
> RefTest
Maybe you could add a comment before the two <mfenced/>'s of bug537916.xhtml to indicate that each blank is a whitespace sequence "U+0020 U+0009 U+000a U+000d" and must not be modified.
Also, you should update the <title/>'s to say that this reftest checks whether the whitespaces are ignored in the "separators" attribute of <mfenced/>.
Otherwise it looks good, thanks.
Reporter | ||
Comment 17•15 years ago
|
||
Also, I think it would be fine if you could rename bug537916*.xhtml to mfenced-1*.xhtml to be consistent with the other reftests.
Assignee | ||
Comment 18•15 years ago
|
||
How about this?
Attachment #428107 -
Attachment is obsolete: true
Reporter | ||
Comment 19•15 years ago
|
||
Comment on attachment 433853 [details] [diff] [review]
RefTest
Looks good to me. Thanks.
Attachment #433853 -
Flags: review?(roc)
Attachment #433853 -
Flags: review?(roc) → review+
Reporter | ||
Updated•15 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 20•15 years ago
|
||
I'm curious..., what tool (if any) would anyone recommend for editing whitespaces changes in text files such as the attached test cases? Can this be efficiently done without a hex editor?
Comment 21•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Flags: in-testsuite+
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a4
Reporter | ||
Comment 22•15 years ago
|
||
(In reply to comment #20)
> I'm curious..., what tool (if any) would anyone recommend for editing
> whitespaces changes in text files such as the attached test cases? Can this be
> efficiently done without a hex editor?
I don't really know... the "classical" editors emacs/vim have an hexadecimal mode and other tools probably also have one.
You need to log in
before you can comment on or make changes to this bug.
Description
•