WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
99620
[MathML] Implement the MathML Operator Dictionary
https://bugs.webkit.org/show_bug.cgi?id=99620
Summary
[MathML] Implement the MathML Operator Dictionary
Dave Barton
Reported
2012-10-17 11:21:22 PDT
The operator dictionary includes default spacing values (CSS margins?) around various infix, prefix, and postfix operators. See <
http://www.w3.org/TR/MathML3/appendixc.html
>.
Attachments
WIP Patch
(11.80 KB, patch)
2013-11-19 08:25 PST
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
WIP Patch
(14.96 KB, patch)
2013-11-20 09:10 PST
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
WIP Patch
(66.53 KB, patch)
2013-11-21 08:48 PST
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
WIP Patch
(73.63 KB, patch)
2013-11-22 00:56 PST
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
script to generate the operator dictionary
(2.31 KB, application/zip)
2013-11-22 00:56 PST
,
Frédéric Wang (:fredw)
no flags
Details
script to generate the operator dictionary
(2.56 KB, application/zip)
2013-11-25 04:08 PST
,
Frédéric Wang (:fredw)
no flags
Details
WIP Patch
(125.75 KB, patch)
2013-11-25 04:12 PST
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
Patch V1
(98.60 KB, patch)
2014-02-19 01:38 PST
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
Patch V2
(98.62 KB, patch)
2014-02-19 02:07 PST
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
Patch V3
(98.63 KB, patch)
2014-02-19 04:51 PST
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
Patch V4
(99.36 KB, patch)
2014-02-19 11:16 PST
,
Frédéric Wang (:fredw)
cfleizach
: review+
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
Frédéric Wang (:fredw)
Comment 1
2013-11-19 08:25:27 PST
Created
attachment 217299
[details]
WIP Patch
Frédéric Wang (:fredw)
Comment 2
2013-11-20 09:10:54 PST
Created
attachment 217441
[details]
WIP Patch
Frédéric Wang (:fredw)
Comment 3
2013-11-20 09:23:21 PST
So I've attached a WIP patch for this bug. I'd like to get feedback about how to create the Operator Dictionary. IIRC, there are ~1000 entries so I've used a hash table. I have an XSLT stylesheet to extract them from the big unicode.xml of
http://www.w3.org/TR/xml-entity-names/
and I can easily convert into whatever formats. I wonder if I should hardcode the table in some (probably separate) C++ file (using macros?) or in a text file that is parsed at init. Should I include the generation of the dictionary in the build system? What is the standard way to do such thing in WebKit?
Frédéric Wang (:fredw)
Comment 4
2013-11-21 08:48:59 PST
Created
attachment 217574
[details]
WIP Patch
Darin Adler
Comment 5
2013-11-21 13:49:51 PST
I think a sorted constant array compiled into the binary, where we do lookups with a binary search, would use much less memory than a hash table, be much smaller than the giant set-up function, not require a special shell script or dependency on xslt, and still have quite good performance.
Frédéric Wang (:fredw)
Comment 6
2013-11-22 00:56:09 PST
Created
attachment 217656
[details]
WIP Patch Thanks Darin, I've rewritten the code using a hardcoded table and binary search. My next issue is to find how to detect the operator form automatically (infix, prefix, postfix). At the moment, it seems to always be postfix when it is not explicitly specified in the MathML code. I'm guessing that when the <mo> renderer is being constructed, it is appended at the end of its parent <mrow> renderer and so does not have any next siblings yet, and so is "postfix". It looks like it will be time to refactor the code with updateFromElement and to make addChild/removeChild works with dynamic changes. I'll come back to this next week but any suggestion is welcome.
Frédéric Wang (:fredw)
Comment 7
2013-11-22 00:56:54 PST
Created
attachment 217657
[details]
script to generate the operator dictionary For the record, here is the script that generates the operator dictionary.
Frédéric Wang (:fredw)
Comment 8
2013-11-25 04:08:38 PST
Created
attachment 217786
[details]
script to generate the operator dictionary
Frédéric Wang (:fredw)
Comment 9
2013-11-25 04:12:18 PST
Created
attachment 217787
[details]
WIP Patch Here is an updated patch. I have tried to use updateFromElement on mrow-like containers. That seems to update the operator form correctly, but the CSS style seems to be lost at the update. Hence I'll open a new bug to do code refactoring for the token elements first and will come back to this bug later. I also suspect all the mrow-like elements do not behave correctly at the moment. This patch also adds several new tests and references to follow-up bugs.
Frédéric Wang (:fredw)
Comment 10
2014-02-17 07:23:35 PST
I think I'll extract the changes and ignore the lspace/rspace support until I get feedback on
bug 124838
. So the op dict will only be used for the stretchy value and forms to start with. This means that many of the tests that relied on the spacing will be removed too.
Frédéric Wang (:fredw)
Comment 11
2014-02-19 01:38:59 PST
Created
attachment 224610
[details]
Patch V1
WebKit Commit Bot
Comment 12
2014-02-19 01:40:10 PST
Attachment 224610
[details]
did not pass style-queue: ERROR: Source/WebCore/rendering/mathml/RenderMathMLFenced.h:50: The parameter name "form" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/WebCore/rendering/mathml/RenderMathMLFenced.h:50: The parameter name "flag" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 2 in 15 files If any of these errors are false positives, please file a bug against check-webkit-style.
Frédéric Wang (:fredw)
Comment 13
2014-02-19 02:07:26 PST
Created
attachment 224614
[details]
Patch V2
Frédéric Wang (:fredw)
Comment 14
2014-02-19 04:51:53 PST
Created
attachment 224622
[details]
Patch V3
chris fleizach
Comment 15
2014-02-19 10:13:52 PST
Comment on
attachment 224622
[details]
Patch V3 View in context:
https://bugs.webkit.org/attachment.cgi?id=224622&action=review
looks pretty good overall to me. some minor comments inside
> Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp:66 > +namespace MathMLOpDict {
I think it might be better to use the unabbreviated forms for op, so that this is MathMLOperatorDictionary
> Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp:70 > +inline UChar ExtractChar(const Entry* aEntry) { return aEntry->character; }
parameter name for these methods should probably just be "entry" instead of aEntry, which isn't used so much in WebCore
> Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp:1145 > + if (element().getAttribute(name) == "true")
should be fastGetAttribute(). you might want to cache the value so you don't have to call it again for the false case
> Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp:1152 > +void RenderMathMLOperator::setOperatorPropertiesFromOpDictEntry(const MathMLOpDict::Entry *entry)
* on wrong side
> Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp:1179 > + if (element().getAttribute(MathMLNames::formAttr) == "prefix")
fastGetAttribute and cache the result in a variable
> Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp:1239 > + String size = element().getAttribute(MathMLNames::minsizeAttr);
fastGetAttr
> Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp:1241 > + size = element().getAttribute(MathMLNames::maxsizeAttr);
ditto
> Source/WebCore/rendering/mathml/RenderMathMLOperator.h:119 > + bool m_isFenceOp;
this should be isFenceOperator I think
Frédéric Wang (:fredw)
Comment 16
2014-02-19 11:16:17 PST
Created
attachment 224657
[details]
Patch V4
chris fleizach
Comment 17
2014-02-19 11:28:32 PST
Comment on
attachment 224657
[details]
Patch V4 thanks
Frédéric Wang (:fredw)
Comment 18
2014-02-20 00:23:43 PST
Committed
r164418
: <
http://trac.webkit.org/changeset/164418
>
Frédéric Wang (:fredw)
Comment 19
2014-03-10 12:25:49 PDT
Mass change: add WebExposed keyword to help MDN documentation.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug