Commit Graph
50 Commits
Author SHA1 Message Date
Frederic Wang ea31ccb21e Bug 1246657 - The Operator Dictionary lack entries for U+1EEF0 and U+1EEF1. r=emilio
This commit ensures that the following operators use category I from
MathML Core's operator dictionary [1] [2]:

  U+1EEF0 ARABIC MATHEMATICAL OPERATOR MEEM WITH HAH WITH TATWEEL
  U+1EEF1 ARABIC MATHEMATICAL OPERATOR HAH WITH DAL

which corresponds to zero lspace/rspace and stretchy. There should
already be exhaustive WPT tests operator-dictionary-* to check
these and other properties, but they may be shadowed by existing
failures or Firefox bugs, so add some more specific reftests for
spacing and stretching. However, nsMathMLmoFrame and nsMathMLChar
don't handle non-BMP characters very well, so only the first one
currently passes.

Also tweak updateOperatorDictionary.pl to ignore these special
operators.

[1] https://w3c.github.io/mathml-core/#dfn-algorithm-to-determine-the-category-of-an-operator
[2] https://w3c.github.io/mathml-core/#operator-dictionary-categories-values

Differential Revision: https://phabricator.services.mozilla.com/D157788
2022-09-23 08:08:43 +00:00
Frederic Wang 6c9bc0accd Bug 1790009, part 3 - Implement special handling for operators using U+0338 and U+20D2. r=emilio
MathML Core specifies that operators containing a UTF-16 strings of
length 2 ending with U+0338 COMBINING LONG SOLIDUS OVERLAY or U+20D2
COMBINING LONG VERTICAL LINE OVERLAY should just use the properties of
the first character. This commit implements that behavior. It removes
obsolete entries that are superseded by this rule and modifies
updateOperatorDictionary.pl to ensure that no such entries are present.

Existing WPT test operator-dictionary-combining.html is already passing
after bug 1789583 because the operators tested use the default spacing.
So extend it to try operators with different spacing.

[1] https://w3c.github.io/mathml-core/#dfn-algorithm-to-determine-the-category-of-an-operator

Differential Revision: https://phabricator.services.mozilla.com/D157707
2022-09-22 12:04:08 +00:00
Frederic Wang 9e28d38ae6 Bug 1790009, part 2 - Operator dictionary: Only accept UTF-16 strings of 1 or 2 characters. r=emilio
MathML Core specifies that operators containing a UTF-16 strings whose
length is not 1 or 2 should use the default properties [1]. This
commit removes the obsolete strings of length 3 from our operator
dictionary and tweak updateOperatorDictionary.pl to ensure it only
accepts strings of 1 or 2 characters. This also adds an early return
in LookupOperator to immediately fallback to default properties.

[1] https://w3c.github.io/mathml-core/#dfn-algorithm-to-determine-the-category-of-an-operator

Differential Revision: https://phabricator.services.mozilla.com/D157706
2022-09-22 12:04:07 +00:00
Frederic Wang 4cd3eb86cb Bug 1790009, part 1: Refactor nsMathMLOperators::LookupOperator(s). r=emilio
nsMathMLOperators::LookupOperators(s) methods are currently use in three
places:

(1) In nsMathMLmoFrame::ProcessTextData(), where we need to check the
    flags for each form of the operator and take the bitwise-or of all
    of them, ignoring lspace/rspace.

(2) In nsMathMLOperators::GetStretchyDirection::ProcessTextData(), where
    we need to check the direction for each form of the operator (in any
    order) and return the first found, ignoring lspace/rspace.

(3) In nsMathMLmoFrame::ProcessOperatorData, where need to check the
    specified form, and try fallback forms in the order prefix, postfix,
    infix. When an entry is found, the code also clears the form bits of
    mFlags and bitwise-or the found flags.

This commit modifies nsMathMLOperators::LookupOperator to only check
one form at once and can be used to easily implement (1) and (2). This
removes the need for nsMathMLOperators::LookupOperators.

A new method nsMathMLOperators::LookupOperatorWithFallback is introduced
to preserve the fallback prefix/postfix/infix check that is needed for
(3). Undocumented bitwise logic is moved out of that method.

Differential Revision: https://phabricator.services.mozilla.com/D157705
2022-09-22 12:04:07 +00:00
Butkovits Atila b74145a6b6 Backed out 3 changesets (bug 1790009) for causing mochitest failures at browser_misused_characters_in_strings.js. CLOSED TREE
Backed out changeset 73ff5b4bf98c (bug 1790009)
Backed out changeset 236e1d9535ed (bug 1790009)
Backed out changeset 90ee5367d506 (bug 1790009)
2022-09-21 15:06:25 +03:00
Frederic Wang f841fd73ce Bug 1790009, part 3 - Implement special handling for operators using U+0338 and U+20D2. r=emilio
MathML Core specifies that operators containing a UTF-16 strings of
length 2 ending with U+0338 COMBINING LONG SOLIDUS OVERLAY or U+20D2
COMBINING LONG VERTICAL LINE OVERLAY should just use the properties of
the first character. This commit implements that behavior. It removes
obsolete entries that are superseded by this rule and modifies
updateOperatorDictionary.pl to ensure that no such entries are present.

Existing WPT test operator-dictionary-combining.html is already passing
after bug 1789583 because the operators tested use the default spacing.
So extend it to try operators with different spacing.

[1] https://w3c.github.io/mathml-core/#dfn-algorithm-to-determine-the-category-of-an-operator

Differential Revision: https://phabricator.services.mozilla.com/D157707
2022-09-21 06:28:05 +00:00
Frederic Wang a8c15f9823 Bug 1790009, part 2 - Operator dictionary: Only accept UTF-16 strings of 1 or 2 characters. r=emilio
MathML Core specifies that operators containing a UTF-16 strings whose
length is not 1 or 2 should use the default properties [1]. This
commit removes the obsolete strings of length 3 from our operator
dictionary and tweak updateOperatorDictionary.pl to ensure it only
accepts strings of 1 or 2 characters. This also adds an early return
in LookupOperator to immediately fallback to default properties.

[1] https://w3c.github.io/mathml-core/#dfn-algorithm-to-determine-the-category-of-an-operator

Differential Revision: https://phabricator.services.mozilla.com/D157706
2022-09-21 06:28:05 +00:00
Frederic Wang 27e2f0002a Bug 1790009, part 1: Refactor nsMathMLOperators::LookupOperator(s). r=emilio
nsMathMLOperators::LookupOperators(s) methods are currently use in three
places:

(1) In nsMathMLmoFrame::ProcessTextData(), where we need to check the
    flags for each form of the operator and take the bitwise-or of all
    of them, ignoring lspace/rspace.

(2) In nsMathMLOperators::GetStretchyDirection::ProcessTextData(), where
    we need to check the direction for each form of the operator (in any
    order) and return the first found, ignoring lspace/rspace.

(3) In nsMathMLmoFrame::ProcessOperatorData, where need to check the
    specified form, and try fallback forms in the order prefix, postfix,
    infix. When an entry is found, the code also clears the form bits of
    mFlags and bitwise-or the found flags.

This commit modifies nsMathMLOperators::LookupOperator to only check
one form at once and can be used to easily implement (1) and (2). This
removes the need for nsMathMLOperators::LookupOperators.

A new method nsMathMLOperators::LookupOperatorWithFallback is introduced
to preserve the fallback prefix/postfix/infix check that is needed for
(3). Undocumented bitwise logic is moved out of that method.

Differential Revision: https://phabricator.services.mozilla.com/D157705
2022-09-21 06:28:05 +00:00
Frederic Wang 7aa1054db7 Bug 1790797 - updateOperatorDictionary.pl does not need to handle minsize, priority or linebreakstyle properties. r=emilio
This is not used at all in our code and are not present in MathML Core's
dictionary. Let's remove them from the Perl script that manage update
of the dictionary.

Differential Revision: https://phabricator.services.mozilla.com/D157318
2022-09-16 05:18:14 +00:00
Frederic Wang 68ce0648d3 Bug 1790789 - Remove "integral" property from the MathML operator dictionary. r=emilio
"integral" is an internal operator property that Gecko uses when
selecting larger variants for integrals, for fonts that don't provide
a good value for DisplayOperatorMinHeight. The code points of operators
having the integral property are located in two contiguous blocks, so
this commit replaces existing implementation with a direct check. There
is no behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D157316
2022-09-16 05:18:13 +00:00
Frederic Wang 01b4b59977 Bug 1790756 - Remove "mirrorable" property from the MathML operator dictionary. r=emilio
Currently, our internal operator dictionary contains a "mirrorable"
property which is used to render stretched or large operators
(such as fences or integrals) in RTL mode, by applying a scale transform.
This is done via the nsMathMLChar class, which is only used for
operators that have a "largeop" or "direction" property in the operator
dictionary [1] [2]. Additionally, this "mirrorable" property was added
with the help of a Perl script, relying on "mirrored" property from
Unicode [3].

This commit removes this property from our internal operator dictionary
and switches to direct retrieval of the Unicode property via
mozilla::intl::UnicodeProperties::IsMirrored. There are four "mirrorable"
characters from our dictionary that are not in [1] (namely
LEFT/RIGHT SINGLE/DOUBLE QUOTATION MARK) but because they don't have
"largeop" or "direction" properties, they don't use nsMathMLChar
anyway. Similarly, they are new characters that are "mirrored" in
Unicode but were not "mirrorable" (LESS-THAN SIGN, LEFT-POINTING DOUBLE
ANGLE QUOTATION MARK, ...) but they won't use nsMathMLChar either.
So there should be no behavior change.

[1] https://searchfox.org/mozilla-central/rev/9769b513e38ee4f5df9d5d1eff55ff7cdc8cbf81/layout/mathml/nsMathMLmoFrame.cpp#58
[2] https://searchfox.org/mozilla-central/rev/9769b513e38ee4f5df9d5d1eff55ff7cdc8cbf81/layout/mathml/nsMathMLmoFrame.cpp#165
[3] https://www.compart.com/en/unicode/mirrored

Differential Revision: https://phabricator.services.mozilla.com/D157303
2022-09-15 05:37:55 +00:00
Frederic Wang 0b6b43d6d1 Bug 1790572 - Minor code refactoring in nsMathMLOperators::LookupOperator(s). r=emilio
- Remove unused boolean return value from
  nsMathMLOperators::LookupOperator.

- Move NS_ASSERTION to validate parameters at the top of
  nsMathMLOperators::LookupOperator.

- The operator form is an integer corresponding to the last two bits of
  nsOperatorFlags, so represent it as uint8_t when passed as a
  parameter of nsMathMLOperators::LookupOperator, as well as in the
  single caller nsMathMLmoFrame::ProcessTextData and in GetOperatorData
  in order to avoid confusion.
  This removes the use of NS_MATHML_OPERATOR_GET_FORM for casting.
  Note that the function already has an NS_ASSERTION to check the
  validity of the parameter.

- Use modern for loop syntax to try the infix, postfix and prefix
  forms in nsMathMLOperators::LookupOperator/LookupOperators instead of
  duplicating code for each GetOperatorData call. Also make more
  explicit the subtle use of lazy evaluation to skip one
  GetOperatorData call from nsMathMLOperators::LookupOperator.

Differential Revision: https://phabricator.services.mozilla.com/D157196
2022-09-14 07:18:05 +00:00
Simon Giesecke c7a36b5d58 Bug 1634281 - Use nsTHashMap instead of nsDataHashtable. r=xpcom-reviewers,necko-reviewers,jgilbert,nika,valentin
Note that this patch only transforms the use of the nsDataHashtable type alias
to a directly equivalent use of nsTHashMap. It does not change the specification
of the hash key type to make use of the key class deduction that nsTHashMap
allows for in some cases. That can be done in a separate step, but requires more
attention.

Differential Revision: https://phabricator.services.mozilla.com/D106008
2021-03-10 10:47:47 +00:00
Simon Giesecke 95c38cc6b8 Bug 1691913 - Rename nsBaseHashtable::Put to InsertOrUpdate. r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
This makes the naming more consistent with other functions called
Insert and/or Update. Also, it removes the ambiguity whether
Put expects that an entry already exists or not, in particular because
it differed from nsTHashtable::PutEntry in that regard.

Differential Revision: https://phabricator.services.mozilla.com/D105473
2021-02-26 09:11:46 +00:00
Simon Giesecke 7b84f2760b Bug 1693001 - Remove redundant nullptr checks of return value of infallible new in layout/. r=emilio
Depends on D105289

Differential Revision: https://phabricator.services.mozilla.com/D105290
2021-02-16 15:52:09 +00:00
Simon Giesecke a69d79b6db Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Ryan Hunt a96492f0f6 Bug 1523969 part 14 - Move method definition inline comments to new line in 'layout/'. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D21115
2019-02-25 16:09:24 -06:00
Sylvestre Ledru e5a134f73a Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset
2018-11-30 11:46:48 +01:00
Jonathan Watt 3fd042669b Bug 1510116. Fix some unified build issues in layout code. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D13039
2018-11-12 22:20:52 +00:00
Daniel Holbert d6d06d82c3 Bug 1483394: Remove unneeded #includes of nsContentUtils.h in /layout. r=TYLin
For each file touched in this patch, the file had an #include for nsContentUtils.h, but no other mentions of the string "nsContentUtils", nor any mention of its "ScriptBlocker"-related types. So these files likely don't need their nsContentUtils.h include anymore, and we can remove it to get a marginal win on build time/complexity.

Differential Revision: https://phabricator.services.mozilla.com/D3370
2018-08-15 07:04:43 +00:00
Daniel Holbert 8fea3c215f Bug 1412346 part 5: (automated patch) Switch a bunch of C++ files in layout to use our standard mode lines. r=jfkthame
This patch was generated automatically by the "modeline.py" script, available
here: https://github.com/amccreight/moz-source-tools/blob/master/modeline.py

For every file that is modified in this patch, the changes are as follows:
 (1) The patch changes the file to use the exact C++ mode lines from the
     Mozilla coding style guide, available here:
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Mode_Line

 (2) The patch deletes any blank lines between the mode line & the MPL
     boilerplate comment.

 (3) If the file previously had the mode lines and MPL boilerplate in a
     single contiguous C++ comment, then the patch splits them into
     separate C++ comments, to match the boilerplate in the coding style.

MozReview-Commit-ID: EuRsDue63tK
2017-10-27 10:33:53 -07:00
Sylvestre Ledru 9d4a84d778 Bug 1378712 - Remove all trailing whitespaces r=Ehsan
MozReview-Commit-ID: Kdz2xtTF9EG
2017-07-06 14:00:35 +02:00
Nicholas Nethercote a0edd1fb5f Bug 1230863 - Remove unused nsPresContext args from many functions. r=roc. 2015-12-06 17:15:53 -08:00
Christoph Kerschbaumer e4ac27d8ff Bug 1222297 - Use channel->Open2() in netwerk/base/nsNetUtil.cpp (r=sicking) 2015-11-08 18:54:38 -08:00
Dragana Damjanovic f5e3e71a6d Bug 905127 - Part 2 - remove unnecessary nsNetUtil.h includes r=jduell 2015-07-06 07:55:00 +02:00
Emanuel Hoogeveen b30abdc582 Bug 905127 - Part 1 - Make some functions from nsNetUtil not inline. r=jduell 2015-07-07 04:17:00 +02:00
Christoph Kerschbaumer 9984cc7023 Bug 1038756: Callsites creating a channel in /layout/mathml/ (r=roc) 2014-09-21 09:41:03 -07:00
Frédéric Wang 0794587a80 Bug 1000879 - Remove the ::-moz-math-stretchy pseudo-element. r=karl, roc 2014-04-24 21:30:00 +02:00
Anuj Agarwal 9c09cc8ae7 Bug 975747 - Convert gOperatorTable to nsDataHashtable. r=karlt 2014-03-18 14:25:40 -07:00
Kyle Huey be9c9b3eba Bug 345123: Remove nsGetterAddRefs<T>'s operator nsISupports**. r=bsmedberg 2014-03-15 12:00:17 -07:00
Ehsan Akhgari 68bfe70f09 Bug 927728 - Part 1: Replace PRUnichar with char16_t; r=roc
This patch was automatically generated by the following script:

#!/bin/bash
# Command to convert PRUnichar to char16_t

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*modules/libmar*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name prtypes.h \
       ! -name Char16.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert PRUnichar char16_t
2014-01-04 10:02:17 -05:00
James Kitchener 1f3aaffae9 Bug 114365 - Remove legacy mathml implementation details and some mathml css cleanup. r=fredw 2013-12-02 11:50:27 -05:00
Ehsan Akhgari c0c974d57c Bug 938850 - Build layout/mathml in unified mode; r=roc 2013-11-14 21:45:38 -05:00
Ehsan Akhgari f25b0852c9 Bug 911292 - Minimize the #includes in layout/mathml; r=mats 2013-08-30 17:37:12 -04:00
Randell Jesup 3b4961b603 Bug 773151: Convert nsCAutoString->nsAutoCString CLOSED TREE r=bsmedberg 2012-09-01 22:35:17 -04:00
Ehsan Akhgari 243c878d26 Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
This patch was generated by a script.  Here's the source of the script for
future reference:

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name nsXPCOMCID.h \
       ! -name prtypes.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert PRInt8 int8_t
convert PRUint8 uint8_t
convert PRInt16 int16_t
convert PRUint16 uint16_t
convert PRInt32 int32_t
convert PRUint32 uint32_t
convert PRInt64 int64_t
convert PRUint64 uint64_t

convert PRIntn int
convert PRUintn unsigned

convert PRSize size_t

convert PROffset32 int32_t
convert PROffset64 int64_t

convert PRPtrdiff ptrdiff_t

convert PRFloat64 double
2012-08-22 11:56:38 -04:00
Aryeh Gregor 2ed3b759bd Bug 782252 - Use NS_FAILED instead of boolean test for ToInteger()/ToFloat(); r=ehsan 2012-08-13 16:49:48 +03:00
Aryeh Gregor 6b3ee254ff Bug 777292 - Convert incorrect conversions to nsresult and fix named constants; r=ehsan 2012-07-27 16:59:29 +03:00
Aryeh Gregor 8b4a23fc4c Bug 777292 part 2 - Change all nsnull to nullptr 2012-07-30 17:20:58 +03:00
Jonathan Watt 131c149f2a Bug 767388 - Kill NS_DEBUG. r=bz. 2012-06-25 20:59:42 +01:00
Gervase Markham cb6a072c2a Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
Frédéric Wang 1369c42833 Mirroring of operators for arabic math (Bug 208309) - part 1. r=karlt 2011-12-21 17:22:00 -05:00
Frédéric Wang 0e1cfebe44 Make lspace/rspace in mo behave as leading/trailing spaces (bug 534963). r=karlt 2011-12-21 17:21:59 -05:00
Ehsan Akhgari 478ad1a412 Bug 690892 - Replace PR_TRUE/PR_FALSE with true/false on mozilla-central; rs=dbaron
Landing on a CLOSED TREE
2011-10-17 10:59:28 -04:00
Michael Wu 0fe7772ece Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones 2011-09-28 23:19:26 -07:00
Frédéric Wang ddec16773d Bug 414277 - scale stretchy operators when there is no glyph of suitable size. r=karlt a=dbaron 2010-08-20 15:44:07 +12:00
Frédéric Wang 1b8f94319e Bug 524275 - Make nsStretchDirection available for any operators. r=karlt a=dbaron 2009-11-21 22:11:05 +01:00
Frederic Wang 7a8eb2ed38 Bug 563365 - nsMathMLOperators::LookupOperators retrieves only the first form found. r=karlt 2009-11-21 23:25:55 +01:00
Frédéric Wang 0d0ad26249 Bug 519126 - MathML Operator Dictionary: improve the syntax of mathfont.properties. r=karlt 2009-09-27 22:32:54 +02:00
Robert O'Callahan a2208f5ccd Bug 484766. Clean up MathML directory structure. r=karlt,ted 2009-03-30 13:48:52 +13:00