For math/mtd, we still include lspace/rspace when we adjust the size of
children in `AddInterFrameSpacingToSize` until bug 2018403 is fixed.
Differential Revision: https://phabricator.services.mozilla.com/D284282
This is controlled by a new lspace_rspace_for_child_spacing_during_mrow_layout
preference (currently only enabled in nightly), which will also account for
lspace/rspace values in a follow-up patch.
Differential Revision: https://phabricator.services.mozilla.com/D284281
For math/mtd, we still include lspace/rspace when we adjust the size of
children in `AddInterFrameSpacingToSize` until bug 2018403 is fixed.
Differential Revision: https://phabricator.services.mozilla.com/D284282
This is controlled by a new lspace_rspace_for_child_spacing_during_mrow_layout
preference (currently only enabled in nightly), which will also account for
lspace/rspace values in a follow-up patch.
Differential Revision: https://phabricator.services.mozilla.com/D284281
Currently, this is a uint32_t with 16 bits used for boolean properties,
2 bits used for operator form and 2 bits used for stretch direction.
Getting and setting all these operator properties is done via C
macros. This patch refactors it so that it holds on a 24bits class
that exposes:
* reference to an `mozilla::EnumSet` called `OperatorBooleans`.
* getter/setter for an enum class called `OperatorForm`.
* getter/setter for an enum class called `OperatorDirection`.
Differential Revision: https://phabricator.services.mozilla.com/D281055
Currently, this is a uint32_t with 16 bits used for boolean properties,
2 bits used for operator form and 2 bits used for stretch direction.
Getting and setting all these operator properties is done via C
macros. This patch refactors it so that it holds on a 24bits class
that exposes:
* reference to an `mozilla::EnumSet` called `OperatorBooleans`.
* getter/setter for an enum class called `OperatorForm`.
* getter/setter for an enum class called `OperatorDirection`.
Differential Revision: https://phabricator.services.mozilla.com/D281055
Currently, when a size variant is used for large variants of stretchy
operators, we modify the bounding box of the glyph by substracting any
specified italic correction from the calculated width. This is to mimic
legacy behavior of old math fonts that were handling subscript of
slanted integrals by specifying a width smaller than the actual glyph
extent.
This causes rendering issues when one draws the background of the
corresponding `<mo>` element, or when a slanted integral is rendered in
right-to-left mode. This bug is also detected by WPT test
mathml/presentation-markup/scripts/subsup-parameters-2.html since
one case assumes subscript is placed at the right of the base minus
the italic correction. We strengthen it a bit by actually checking the
base's width is properly set.
MathML Core describes italic correction of all MathML boxes (
measurement of how slanted they are), how it can be calculated
recursively from the box's children and how it applies to sub/sup
script positioning. In this patch, we implement a simplified version
addressing above issues and covering simple cases currently supported
by browsers and actually useful in practice.
Differential Revision: https://phabricator.services.mozilla.com/D277987
The "Find in Page" result appears as a normal selection range and the
selection's display is "attention". And that may select characters in
unselectable elements including `::before`/`::after` pseudo elements.
At least while the selection's display is "attention", we should paint
the normal selection in any nodes.
Note that once the selection's display is set to "on", the selection
becomes invisible since the user not selectable and won't appear as
visible text when you copy the selection to the clipboard. If this is
a bad UI, we should change the behavior in a follow up bug.
Differential Revision: https://phabricator.services.mozilla.com/D274550
The other browsers do not support multiple selection ranges. Therefore,
they never split selection ranges to exclude non-selectable nodes.
To align the behavior, we should do so. However, to keep current
look of `Selection` which is similar to Chrome's behavior, we should
make the selection painters ignore normal selections if their content
is not selectable.
Note that this patch allows painting selected text when there are some
IME selections even if `user-select` is `none` because the normal
selection is also a part of IME selections. Although our widget
currently do not use non-collapsed normal selection during a
composition, it may be changed to support new IME in the future.
Differential Revision: https://phabricator.services.mozilla.com/D272187
Add counters and warnings for deprecated uses of the accent property
from the operator dictionary.
Add a new mathml.operator_dictionary_accent.disabled property to control
whether the accent property should be parsed from the dictionary. It is
off by default so there are no behaviour changes.
Differential Revision: https://phabricator.services.mozilla.com/D269049
Add counters and warnings for deprecated uses of the accent property
from the operator dictionary.
Add a new mathml.operator_dictionary_accent.disabled property to control
whether the accent property should be parsed from the dictionary. It is
off by default so there are no behaviour changes.
Differential Revision: https://phabricator.services.mozilla.com/D269049
Add counters and warnings for deprecated uses of the accent property
from the operator dictionary.
Add a new mathml.operator_dictionary_accent.disabled property to control
whether the accent property should be parsed from the dictionary. It is
off by default so there are no behaviour changes.
Differential Revision: https://phabricator.services.mozilla.com/D269049
Add counters and warnings for deprecated uses of the accent property
from the operator dictionary.
Add a new mathml.operator_dictionary_accent.disabled property to control
whether the accent property should be parsed from the dictionary. It is
off by default so there are no behaviour changes.
Differential Revision: https://phabricator.services.mozilla.com/D269049
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
`MutationEvent_Bindings::MODIFICATION`,
`MutationEvent_Bindings::ADDITION` and `MutationEvent_Bindings::REMOVAL`
will be removed. Therefore, we need alternative `enum class` for that.
This patch makes `nsIFrame` and subclasses use the new one.
Differential Revision: https://phabricator.services.mozilla.com/D263053
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
Currently, nsMathMLContainerFrame::AttributeChanged always force a
reflow. This patch removes that behavior tweaks the following derived
classes:
- menclose: Don't mark intrinsic size of descendants dirty, since the
notation is added around the children, only affecting the element's
metrics.
- mfrac: Don't mark intrinsic size dirty for the linethickness
attribute, since it only affects vertical metrics.
- mo: Rebuild 'automatic' data and relayout the entire embellished
operator hierarchy for all operator properties. I haven't checked the
details of the MathML 'automatic' data, so it may be a bit too
aggressive. But at least a reflow is necessary.
- mspace/mpadded: Only mark intrinsic size dirty for the element and
ancestors, and only for attributes affecting vertical metrics. Also
remove `InvalidateFrame()` call since we don't have any display item.
- mtable: Don't force reflow or data rebuild when displaystyle changes.
This was probably needed before displaystyle was re-implemented as
an attribute mapped to the math-style CSS property.
There is at least one dynamic test for each of the MathML
attributes affecting layout and they don't regress after this patch:
https://bugzilla.mozilla.org/show_bug.cgi?id=1918308#c0
Differential Revision: https://phabricator.services.mozilla.com/D221925
After bug 1890531, mathml.centered_operator is disabled and
U+002D HYPHEN-MINUS in <mo> no longer renders as U+2212 MINUS SIGN.
This patches restore this behavior as the change was unintentional, even
though this is not specified in MathML Core.
Differential Revision: https://phabricator.services.mozilla.com/D219085
After bug 1890531, mathml.centered_operator is disabled and
U+002D HYPHEN-MINUS in <mo> no longer renders as U+2212 MINUS SIGN.
This patches restore this behavior as the change was unintentional, even
though this is not specified in MathML Core.
Differential Revision: https://phabricator.services.mozilla.com/D219085
After bug 1890531, mathml.centered_operator is disabled and
U+002D HYPHEN-MINUS in <mo> no longer renders as U+2212 MINUS SIGN.
This patches restore this behavior as the change was unintentional, even
though this is not specified in MathML Core.
Differential Revision: https://phabricator.services.mozilla.com/D219085
This commit ensures MathML boolean attributes (namely displaystyle,
mo@stretchy, mo@symmetric, mo@largeop, mo@movablelimits,
munder@accentunder, mover@accent, munderover@accent,
munderover@accentunder) are ASCII case-insensitive [1]. For
displaystyle that was handled in [2]. For mover/munder/munderover
attributes, this is covered by a test case from scriptlevel-001.html
checking both case-insensitivity and dynamic changes at the same time ;
the latter still seems broken, so these checks are moved into separate
test cases. For mo attributes, a new WPT test is added. Note that
mo@accent, mo@fence, mo@separator are not part of MathML Core (with the
two last without visual effect), we make them case-insensitive for
consistency but don't bother adding tests for them.
[1] https://w3c.github.io/mathml-core/#dfn-boolean used here:
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=1574087
Differential Revision: https://phabricator.services.mozilla.com/D218944