Removed the Reflow Input in nsIFrame. Added includes for ReflowInput as
necessary in cpp files. Also Forward Declared nsLineLayout in 3 header
files.
Differential Revision: https://phabricator.services.mozilla.com/D298203
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
This is suppose to be considered for entries of `kInterFrameSpacingTable`
that have a non-zero halfbyte but that's no longer happening since
bug 133761.
Differential Revision: https://phabricator.services.mozilla.com/D278763
After switching the old MathML interspacing code to enum class, Coverity
complains that GET_INTERSPACE could overrun `kInterFrameSpacingTable` if
the value `MathMLFrameType::Count` is passed as a frame type. This is
actually just used to determine the size of `kInterFrameSpacingTable`
and is not an actual frame type used by the MathML code. So remove it
from the enum and convert it to a constexpr MathMLFrameTypeCount instead.
To conveniently calculate it, we move the `MathMLFrameType::Unknown`
at the last position of the enum class.
Differential Revision: https://phabricator.services.mozilla.com/D278739
nsMathMLContainerFrame (and its derived classes) relies on a
FinishReflow() method that is called at the end of Reflow(). So just
clear the NS_MATHML_STRETCH_DONE bit there instead of DidReflow().
Differential Revision: https://phabricator.services.mozilla.com/D226118
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
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
This method is now only used at one place (more precisely, inside the
nsMathMLContainerFrame::GetIntrinsicISizeMetrics() method) and only
calls the Place() method with the IntrinsicSize + MeasureOnly flags.
This patch removes it and instead ensure we call Place() directly from
GetIntrinsicISizeMetrics(). There is no behavior changes.
Differential Revision: https://phabricator.services.mozilla.com/D221630
This patch tweaks implementation of AttributeChanged() in MathML layout
classes to be more consistent:
1. Only handle MathML-specific attributes in the default namespace.
2. Return immediately for class attributes, or forward the call to
the parent class (or grandparent class).
Currently, nsMathMLContainerFrame::AttributeChanged() always forces a
reflow but this change does not cause new calls to it, except for the
edge case of accent/accentunder attributes in the non-default namespace
(nsMathMLmunderoverFrame). Not doing more for
nsMathMLmencloseFrame/nsMathMLmfracFrame breaks some tests, but we can
probably do a weaker invalidation. See bug 1918308 for a follow-up.
Differential Revision: https://phabricator.services.mozilla.com/D221921
This method is now only used at one place (more precisely, inside the
nsMathMLContainerFrame::GetIntrinsicISizeMetrics() method) and only
calls the Place() method with the IntrinsicSize + MeasureOnly flags.
This patch removes it and instead ensure we call Place() directly from
GetIntrinsicISizeMetrics(). There is no behavior changes.
Differential Revision: https://phabricator.services.mozilla.com/D221630
This patch tweaks implementation of AttributeChanged() in MathML layout
classes to be more consistent:
1. Only handle MathML-specific attributes in the default namespace.
2. Return immediately for class attributes, or forward the call to
the parent class (or grandparent class).
Currently, nsMathMLContainerFrame::AttributeChanged() always forces a
reflow but this change does not cause new calls to it, except for the
edge case of accent/accentunder attributes in the non-default namespace
(nsMathMLmunderoverFrame). Not doing more for
nsMathMLmencloseFrame/nsMathMLmfracFrame breaks some tests, but we can
probably do a weaker invalidation. See bug 1918308 for a follow-up.
Differential Revision: https://phabricator.services.mozilla.com/D221921
This patch changes the signature to `GetMinISize()`, `GetPrefISize()`,
`IntrinsicISize` by adding a helper struct as a preparation. Then we can just
add more data such as a percentage basis to the struct without altering the
signature in the future.
When passing `IntrinsicSizeInput` struct down to another helper method, we
generally just pass the original one if the method is computing the intrinsic
size of our own or our anonymous children. If the method is computing our
children's intrinsic contribution, we'll need to create a brand new
`IntrinsicSizeInput` for our children.
Differential Revision: https://phabricator.services.mozilla.com/D219521
This patch changes the signature to `GetMinISize()`, `GetPrefISize()`,
`IntrinsicISize` by adding a helper struct as a preparation. Then we can just
add more data such as a percentage basis to the struct without altering the
signature in the future.
When passing `IntrinsicSizeInput` struct down to another helper method, we
generally just pass the original one if the method is computing the intrinsic
size of our own or our anonymous children. If the method is computing our
children's intrinsic contribution, we'll need to create a brand new
`IntrinsicSizeInput` for our children.
Differential Revision: https://phabricator.services.mozilla.com/D219521
MathML classes has a few Place*() methods used for layout and intrinsic
size calculation. These methods have a parameter "aPlaceOrigin"
indicating whether the children and other painted objects should have
their final positions set, or if the method is only called for measuring.
This parameter is typically set to false when doing intrinsic size
calculation or when performing some non-final measurement for operator
stretching.
For intrinsic size calculation, it is generally enough to perform
placement with aPlaceOrigin=false and ignoring the vertical metrics.
Some Place*() methods also have a parameter "aWidthOnly" for special
handling. For example, msqrt stretches a radical symbol vertically to
match the height of the content but when doing intrinsic size
calculation this is approximated to nsMathMLChar::GetMaxWidth() instead.
When we implement border/padding/margin we should also be able to
choose between using IntrinsicISizeOffsets() or GetUsed*() methods.
Finally, some Place*() methods initially call a place routing of a
parent class before further tweaking the layout. For example, msqrt
uses mrow layout on children and adds some radical symbol on top of
them. When we implement border/padding, we should make sure we don't
add the border/padding before the final result.
In order to handle all these placement behaviors, a new EnumSet is
introduced. This commit does not change behavior. Handling of padding,
border and margin will be handled in follow-up patches.
Differential Revision: https://phabricator.services.mozilla.com/D216669