Commit Graph
154 Commits
Author SHA1 Message Date
Frédéric Wang Nélar b1a1dcc0b1 Bug 2026637 - Determine RTL direction from nsIFrame::mWritingMode. r=emilio,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D290141
2026-03-26 20:02:07 +00:00
Frédéric Wang Nélar 76bfbc593d Bug 2023903 - Remove preference mathml.math_shift.enabled. r=emilio,firefox-style-system-reviewers,layout-reviewers
This has been enabled by default starting with Firefox 146.

Differential Revision: https://phabricator.services.mozilla.com/D288193
2026-03-26 08:54:04 +00:00
agoloman 6fb4312b1e Revert "Bug 2023903 - Remove preference mathml.rtl_operator_mirroring.enabled. r=emilio,layout-reviewers" for causing gtest failures @MathMLPrefs_NonAdjacent.
This reverts commit ada83c01ee.

Revert "Bug 2023903 - Remove preference mathml.math_shift.enabled. r=emilio,firefox-style-system-reviewers,layout-reviewers"

This reverts commit 59effc5f70.
2026-03-24 12:49:13 +00:00
Frédéric Wang Nélar 59effc5f70 Bug 2023903 - Remove preference mathml.math_shift.enabled. r=emilio,firefox-style-system-reviewers,layout-reviewers
This has been enabled by default starting with Firefox 146.

Differential Revision: https://phabricator.services.mozilla.com/D288193
2026-03-24 11:34:29 +00:00
Atila Butkovits a420a28d11 Revert "Bug 2023903 - Remove preference mathml.rtl_operator_mirroring.enabled. r=emilio,layout-reviewers" for causing failures at UserCharacteristics_MathMLPrefs_NonAdjacent.
This reverts commit 8bcd92b612.

Revert "Bug 2023903 - Remove preference mathml.math_shift.enabled. r=emilio,firefox-style-system-reviewers,layout-reviewers"

This reverts commit febddccfd1.
2026-03-24 00:52:51 +00:00
Frédéric Wang Nélar febddccfd1 Bug 2023903 - Remove preference mathml.math_shift.enabled. r=emilio,firefox-style-system-reviewers,layout-reviewers
This has been enabled by default starting with Firefox 146.

Differential Revision: https://phabricator.services.mozilla.com/D288193
2026-03-23 10:34:26 +00:00
Sylvestre Ledru 55481ac4b5 Bug 2023419 - Remove Emacs/Vim modelines from layout/ r=emilio,firefox-style-system-reviewers,layout-reviewers
replaced by .editorconfig

Differential Revision: https://phabricator.services.mozilla.com/D287852
2026-03-17 12:05:43 +00:00
Frédéric Wang 88aaf03123 Bug 2013273 - Convert MathML stretch flags to mozilla::EnumSet. r=layout-reviewers,dshin
Differential Revision: https://phabricator.services.mozilla.com/D280949
2026-02-03 16:00:51 +00:00
Frédéric Wang f0727f2777 Bug 2013273 - Make nsStretchDirection an enum class. r=emilio,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D280935
2026-02-03 16:00:41 +00:00
agoloman cdb00cbee7 Revert "Bug 2013273 - Make GetPreferredStretchSize calculation mode an enum class. r=layout-reviewers,dshin" for causing build bustages @nsMathMLOperators.h.
This reverts commit 9c8eddd444.

Revert "Bug 2013273 - Modernize implementation of nsOperatorFlags. r=layout-reviewers,dshin"

This reverts commit 6cbde817db.

Revert "Bug 2013273 - Ensure underlying types for MathMLFrameType and DrawingMethod are uint8_t. r=layout-reviewers,dshin"

This reverts commit bb3d80f482.

Revert "Bug 2013273 - Convert MathML stretch flags to mozilla::EnumSet. r=layout-reviewers,dshin"

This reverts commit 0abd326292.

Revert "Bug 2013273 - Make mtable eAlign an enum class. r=layout-reviewers,dshin"

This reverts commit da72abe4b4.

Revert "Bug 2013273 - Make nsMencloseNotation an enum class. r=layout-reviewers,dshin"

This reverts commit 1051d05264.

Revert "Bug 2013273 - Make nsStretchDirection an enum class. r=emilio,layout-reviewers"

This reverts commit a98c372331.
2026-02-03 09:57:20 +00:00
Frédéric Wang 0abd326292 Bug 2013273 - Convert MathML stretch flags to mozilla::EnumSet. r=layout-reviewers,dshin
Differential Revision: https://phabricator.services.mozilla.com/D280949
2026-02-03 09:06:19 +00:00
Frédéric Wang a98c372331 Bug 2013273 - Make nsStretchDirection an enum class. r=emilio,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D280935
2026-02-03 09:06:10 +00:00
Frédéric Wang eb94b292ae Bug 2008902 - Convert MathML presentation flags to mozilla::EnumSet. r=emilio,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D278091
2026-01-08 15:26:30 +00:00
Eri Pazos Pérez 5a7ec7cbb1 Bug 1925478 - Remove unused paths from nsMathMLContainerFrame::Place r=emilio,fredw,layout-reviewers
Preliminary patch to removing the return value of Place, as it is always
NS_OK. The logic associated with it being false has also been removed,
along with DidReflowChildren, which was only called in these paths.

Differential Revision: https://phabricator.services.mozilla.com/D265801
2025-09-23 14:41:03 +00:00
Eri Pazos Pérez 49a7419209 Bug 1923569 - Implement math-shift: compact. r=fredw,emilio,firefox-style-system-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D260440
2025-08-19 12:31:35 +00:00
Alexandru Marc 4ba9672c61 Revert "Bug 1923569 - Implement math-shift: compact. r=fredw,emilio,firefox-style-system-reviewers" for causing non-unified build bustages @ nsMathMLmrootFrame.cpp
This reverts commit ed9282cc21.
2025-08-18 16:46:44 +00:00
Eri Pazos Pérez ed9282cc21 Bug 1923569 - Implement math-shift: compact. r=fredw,emilio,firefox-style-system-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D260440
2025-08-18 15:24:31 +00:00
Emilio Cobos Álvarez a8a2311474 Bug 1976457 - Sort includes in layout/. r=janv,dshin
Interesting bit is layout/.clang-format, the rest is all automated.

Differential Revision: https://phabricator.services.mozilla.com/D256616
2025-07-09 13:24:00 +00:00
Tom Schuster b8d11d463f Bug 1951893 - Remove unneeded StaticAtom suffixes. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D240598
2025-03-11 11:36:09 +00:00
Jonathan Watt 3eab38263b Bug 1931736. Add missing braces around if/loop statements in layout/mathml/. r=layout-reviewers,emilio
Depends on D229249

Differential Revision: https://phabricator.services.mozilla.com/D229250
2024-11-17 05:03:59 +00:00
Frédéric Wang 9c073c74f4 Bug 1916988 - Support CSS width/height properties on MathML elements. r=emilio
This patch implements support for the width/height properties on
MathML elements [1]. The general algorithm from the spec is as
follows:

(1) The outcome of the math layout is a "math content box".
(2) The content box sets its size from computed width/height values. If
  auto, it's the one of the "math content box". This patch ignores
  percentage values for now [2] [3].
(3) math content box is shifted so that its inline-start and top edges
  aligns with the ones of the content box. There are exceptions
  elements like mfrac and munder/mover/munderover which instead
  horizontally center the math content box within the content box.
  For baseline adjustment, we follow what Chromium does, see [4].
(4) Padding+border are added around the content box. Note that we
  ignore the box-sizing property for now [5].

The patch essentially tweaks the various MathML layout algorithms to
perform steps (3) and (4) before the calls to
GetBorderPaddingForPlace and InflateReflowAndBoundingMetrics.

[1] https://w3c.github.io/mathml-core/#layout-algorithms
[2] https://github.com/w3c/mathml-core/issues/76
[3] https://github.com/w3c/mathml-core/issues/77
[4] https://github.com/w3c/mathml-core/issues/259
[5] https://github.com/w3c/mathml-core/issues/257

Below is more information about test coverage:

- width-height-001: Verify that width, height, inline-size and block-size
  properties sets the size of the content box. This test used to verify
  they are ignored, this patch fixes the `<meta name="assert">` tag.
  It also adds a test for the case the specified size is smaller than the
  content (we force non empty descendants to make sure this content is
  large enough) and to verify the width is used for the preferred width.

- width-height-002, width-height-003: These are reftests visually checking
  offsets of the math content box within a larger content box (specified
  by width/height) for the mtext, mrow, mpadded, mfrac, msqrt, mroot,
  in LTR/RTL modes. In particular they allow to verify some painted
  elements like fraction bar and radical symbols.

- width-height-004: This test more directly checks that the math content
  box is horizontally centered within a larger content box for munder,
  mover, munderover and mfrac. This patch extends the test to cover the
  case when the math content box is wider (i.e. overflowing outside the
  content box) and removes unnecessary specified height.

- width-height-005: New test for other layout algorithm that don't
  center the math content box, checking inline-start edges of children
  when a width is specified. We check both LTR/RTL modes and
  wider/narrower content boxes.

- width-height-006: Same but checking the top edges for larger/smaller
  height and verifying that baseline is perserved.

Differential Revision: https://phabricator.services.mozilla.com/D221436
2024-09-30 12:18:39 +00:00
Frédéric Wang 9969c687b8 Bug 1918310 - Remove class nsMathMLmsqrtFrame. r=emilio
This class is currently only used to override InheritAutomaticData() and
IsMrowLike(). This patch moves that directly in nsMathMLrootFrame.
Probably we should have the same behavior when ShouldUseRowFallback()
returns true, but this patch does not try and change anything.

Differential Revision: https://phabricator.services.mozilla.com/D222258
2024-09-17 18:25:45 +00:00
Frédéric Wang 30e379cb5a Bug 1918310 - Make mroot and msqrt should share their implementation. r=emilio
The msqrt and mroot elements are used to draw radical symbols [1]. That
used to be the case for menclose (until notation="radical" was removed
in [2]) and that's the only reason why nsMathMLmsqrtFrame is deriving
from nsMathMLmencloseFrame. This patch makes it derive from
nsMathMLmrootFrame instead to remove unnecessary code duplication.

[1] https://w3c.github.io/mathml-core/#radicals-msqrt-mroot
[21 https://bugzilla.mozilla.org/show_bug.cgi?id=1783995]

Differential Revision: https://phabricator.services.mozilla.com/D222123
2024-09-17 18:25:45 +00:00
Frédéric Wang a5c1ebec25 Bug 1918989 - Remove disabled SHOW_BOUNDING_BOX MathML code. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D222260
2024-09-16 13:27:10 +00:00
Frédéric Wang 26b5709220 Bug 1917763 - Do not override MeasureForWidth/Reflow for mroot. r=emilio
This patch reimplements layout of the mroot element by overridding the
Place() method, which is used by nsMathMLContainerFrame for the
implementation of Reflow and MeasureForWidth. These two latter methods
then don't need to be overridden anymore in nsMathMLmrootFrame.

Differential Revision: https://phabricator.services.mozilla.com/D221629
2024-09-13 08:03:56 +00:00
Butkovits Atila aeafb698d8 Backed out 8 changesets (bug 1917763) for causing bustages at nsMathMLmspaceFrame.h. CLOSED TREE
Backed out changeset 7c7c002d7db2 (bug 1917763)
Backed out changeset 10eb2ccfa645 (bug 1917763)
Backed out changeset 9ba90d161930 (bug 1917763)
Backed out changeset ab7ce0058852 (bug 1917763)
Backed out changeset 19766c906c98 (bug 1917763)
Backed out changeset d1b87bb6e8d4 (bug 1917763)
Backed out changeset 043cf853e2cf (bug 1917763)
Backed out changeset a869862a66ec (bug 1917763)
2024-09-12 18:35:55 +03:00
Frédéric Wang 62e40f8a07 Bug 1917763 - Do not override MeasureForWidth/Reflow for mroot. r=emilio
This patch reimplements layout of the mroot element by overridding the
Place() method, which is used by nsMathMLContainerFrame for the
implementation of Reflow and MeasureForWidth. These two latter methods
then don't need to be overridden anymore in nsMathMLmrootFrame.

Differential Revision: https://phabricator.services.mozilla.com/D221629
2024-09-12 14:26:28 +00:00
Frédéric Wang 32815b655f Bug 1908069 - Add border/padding/margin support to msqrt, mroot and menclose. r=emilio
See D216670 for the general approach taken.

Differential Revision: https://phabricator.services.mozilla.com/D216980
2024-08-07 06:00:45 +00:00
Iulian Moraru 096c9e730e Backed out 7 changesets (bug 1908069) for causing wr failures on mo-lspace-rspace-4.html. CLOSED TREE
Backed out changeset d497ae104185 (bug 1908069)
Backed out changeset c87b8ca300dc (bug 1908069)
Backed out changeset 3e76c02843a7 (bug 1908069)
Backed out changeset f4c5983c700b (bug 1908069)
Backed out changeset 5468da212605 (bug 1908069)
Backed out changeset ab5ab71ddfc4 (bug 1908069)
Backed out changeset 21269d373fff (bug 1908069)
2024-08-01 19:45:36 +03:00
Frédéric Wang 63e4704314 Bug 1908069 - Add border/padding/margin support to msqrt, mroot and menclose. r=emilio
See D216670 for the general approach taken.

Differential Revision: https://phabricator.services.mozilla.com/D216980
2024-08-01 12:58:09 +00:00
Tamas Szentpeteri 5098f477fd Backed out 7 changesets (bug 1908069) for causing mochitest failures related to EnumSet.h. CLOSED TREE
Backed out changeset 7a9063b6e9f1 (bug 1908069)
Backed out changeset 6b8c788b3fb3 (bug 1908069)
Backed out changeset 6775a291fb83 (bug 1908069)
Backed out changeset 526b1ba8c610 (bug 1908069)
Backed out changeset e7797c083647 (bug 1908069)
Backed out changeset 2c4076a423fa (bug 1908069)
Backed out changeset 8fac35770369 (bug 1908069)
2024-07-31 18:45:21 +03:00
Frédéric Wang 2c680f5b8c Bug 1908069 - Add border/padding/margin support to msqrt, mroot and menclose. r=emilio
See D216670 for the general approach taken.

Differential Revision: https://phabricator.services.mozilla.com/D216980
2024-07-31 14:14:30 +00:00
icesfont 913e2cf39a Bug 1907082 - Clamp radical kern degrees for mroot. r=fredw
According to the spec [1], we should be clamping the radical kern before degree to be positive and the radical kern after degree to be absolutely less than the width of the index margin box.

Also provide a default for the radical kern before degree according to the spec too [2].

[1] https://w3c.github.io/mathml-core/#root-with-index
[2] https://w3c.github.io/mathml-core/#dfn-radicalkernbeforedegree

Differential Revision: https://phabricator.services.mozilla.com/D217437
2024-07-24 17:55:24 +00:00
Frédéric Wang 1b3444926e Bug 1883950 - Remove dead code for MathML invalid markup. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D203788
2024-03-06 19:10:07 +00:00
Sylvestre Ledru b0fe72dee5 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-15 15:29:02 +00:00
Cristina Horotan 7388749830 Backed out 2 changesets (bug 1856795) for causing build bustage at BasicEvents.h CLOSED TREE
Backed out changeset 1d98b028923a (bug 1856795)
Backed out changeset eae2ac93e17c (bug 1856795)
2023-10-14 21:42:14 +03:00
Sylvestre Ledru 4a97019e39 Bug 1856795 - Remove redundant member init r=emilio
Done with:
./mach static-analysis check --checks="-*, readability-redundant-member-init" --fix .

https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-member-init.html

Differential Revision: https://phabricator.services.mozilla.com/D190002
2023-10-14 17:34:26 +00:00
Frederic Wang 4eab0ed25c Bug 1845707 - Remove preferences for invalid markup. r=emilio
This commit removes the preference
mathml.error_message_layout_for_invalid_markup.disabled that controls
whether we layout invalid markup with the special "invalid-markup"
message. It has been set to true since Firefox 106. For now, this
"invalid-markup" layout is still used for the legacy implementation
of the <maction> element and will be removed in bug 1788223.

Differential Revision: https://phabricator.services.mozilla.com/D184691
2023-07-31 05:23:26 +00:00
Iulian Moraru 98e647c031 Backed out changeset 10692fd51184 (bug 1845707) for causing Bug 1845914. CLOSED TREE 2023-07-30 16:51:28 +03:00
Frederic Wang 49e0f155ac Bug 1845707 - Remove preferences for invalid markup. r=emilio
This commit removes the preference
mathml.error_message_layout_for_invalid_markup.disabled that controls
whether we layout invalid markup with the special "invalid-markup"
message. It has been set to true since Firefox 106. For now, this
"invalid-markup" layout is still used for the legacy implementation
of the <maction> element and will be removed in bug 1788223.

Differential Revision: https://phabricator.services.mozilla.com/D184691
2023-07-28 05:43:16 +00:00
Noemi Erli 63b0c2e194 Backed out changeset c6981d9b3b12 (bug 1845707) for causing bustage in nsMathMLSelectedFrame.cpp 2023-07-27 17:56:58 +03:00
Frederic Wang 6a3581f06c Bug 1845707 - Remove preferences for invalid markup. r=emilio
This commit removes the preference
mathml.error_message_layout_for_invalid_markup.disabled that controls
whether we layout invalid markup with the special "invalid-markup"
message. It has been set to true since Firefox 106. For now, this
"invalid-markup" layout is still used for the legacy implementation
of the <maction> element and will be removed in bug 1788223.

Differential Revision: https://phabricator.services.mozilla.com/D184691
2023-07-27 13:56:47 +00:00
sskcvqikf 9a203ce2a6 Bug 1797012 - Change NS_STYLE_MATH_STYLE_* macros to enum StyleMathStyle. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160016
2022-10-24 17:47:34 +00:00
Marian-Vasile Laza b44b3fb628 Backed out changeset f39d284f4db7 (bug 1797012) for causing wpt failures on frac-1.html. CLOSED TREE 2022-10-24 15:46:12 +03:00
sskcvqikf 97899b4a8d Bug 1797012 - Change NS_STYLE_MATH_STYLE_* macros to enum StyleMathStyle. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160016
2022-10-24 09:29:05 +00:00
Frederic Wang d3fff0eddd Bug 1583037 - Do not layout MathML as an error message when a layout error occurs. r=emilio
See https://groups.google.com/g/mozilla.dev.platform/c/hMf_Z1JSApQ

Differential Revision: https://phabricator.services.mozilla.com/D46725
2022-09-06 09:51:52 +00:00
Ting-Yu Lin 06ddbd2b65 Bug 1464761 Part 4 - Remove nsReflowStatus::mTruncated bit. r=dholbert
In the description of the mTruncated bit, its purpose is the same as calling
SetInlineLineBreakBeforeAndReset(). We've removed all its usages in previous
patches, so the bit is no longer needed.

Differential Revision: https://phabricator.services.mozilla.com/D151461
2022-07-27 21:55:18 +00:00
Andrew Osmond 66c6bad8f6 Bug 1779519 - gfxFontCache expiration tracker operations should be more atomic. r=jfkthame
gfxFontCache acquires and releases its mutex during various operations.
In order to keep the state internally consistent, we should only release
the lock after the full operation is complete. This involves moving the
deletion of gfxFont to outside the lock via a temporary discard array.

The expiration state should not be protected by the gfxFont's mutex
since we don't hold it during most operations. Instead we should hold
gfxFontCache's mutex because then we can guarantee the operation is
atomic, particularly when a worker wants a font, and the main thread is
aging the generations.

When a font is returned from gfxFontCache, we now return it already
removed from the tracker, and with its refcount updated. This avoids any
potential races between the expiration timer and a worker accessing the
font, as well as simplying the callers so they don't need to be aware of
addref-ing manually in case the result is to be discarded (so that it
gets readded to the tracker).

Differential Revision: https://phabricator.services.mozilla.com/D151821
2022-07-14 19:53:09 +00:00
criss 380e3e436f Backed out changeset e4cd98b5984d (bug 1779519) for causing build bustages. CLOSED TREE 2022-07-14 22:06:53 +03:00
Andrew Osmond 8cb302b7c5 Bug 1779519 - gfxFontCache expiration tracker operations should be more atomic. r=jfkthame
gfxFontCache acquires and releases its mutex during various operations.
In order to keep the state internally consistent, we should only release
the lock after the full operation is complete. This involves moving the
deletion of gfxFont to outside the lock via a temporary discard array.

The expiration state should not be protected by the gfxFont's mutex
since we don't hold it during most operations. Instead we should hold
gfxFontCache's mutex because then we can guarantee the operation is
atomic, particularly when a worker wants a font, and the main thread is
aging the generations.

When a font is returned from gfxFontCache, we now return it already
removed from the tracker, and with its refcount updated. This avoids any
potential races between the expiration timer and a worker accessing the
font, as well as simplying the callers so they don't need to be aware of
addref-ing manually in case the result is to be discarded (so that it
gets readded to the tracker).

Differential Revision: https://phabricator.services.mozilla.com/D151821
2022-07-14 18:35:49 +00:00