Commit graph

127 commits

Author SHA1 Message Date
Moonchild
5235861f6e Issue #2284 - Add exception for flex/grid items resolving percentages against parent.
This folds in BZ bugs 1578586 and 1092007 part 2.
2023-08-17 09:09:43 +08:00
Moonchild
2f117eecaa Issue #1656 - Remove more vim control lines.
Vim control lines were re-introduced or not entirely cleaned up.
This nukes them again.
Removing from embedding, extensions, gfx, hal, ipc, layout, mailnews,
media and memory. More to come.
2023-05-05 22:57:19 +08:00
FranklinDM
010db07bf3 Issue #2135 - Bug 1066965: Make contentEditable and spellchecking to work in Shadow DOM 2023-03-06 16:16:21 +08:00
Job Bautista
ca3361fb57 Issue #2068 - Only wrap the last line of inline elements when positively padding to the right.
This fixes the 21 year old Mozilla bug 122795.

Co-authored-by: Jonathan Kew <jfkthame@gmail.com>
2022-12-30 09:21:14 +08:00
Job Bautista
09cbcd3413 Issue #2063 - Ensure a floated ::first-letter inherits from ::first-line.
This fixes the 24 year old Mozilla bug 13610.

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
2022-12-30 09:09:13 +08:00
Moonchild
1868e88741 Fix some debug assertions.
refactored code porting in assertions causing debug build failures.
2022-10-06 10:26:38 +08:00
roytam1
52a48df032 Revert "Issue #1986 - Use logical coordinates in flex containers."
This reverts commit 7527371d78.
2022-09-29 15:18:18 +08:00
roytam1
c522a01d6c Revert "Issue #1986 - Part 2: Add IsItemInlineAxisMainAxis() and rework some nsFrame code."
This reverts commit c3e18955ad.
2022-09-29 15:18:10 +08:00
Moonchild
b27475f6a9 Issue #80 - Re-unify most of the layout engine 2022-09-09 10:12:59 +08:00
Jeremy Andrews
c3e18955ad Issue #1986 - Part 2: Add IsItemInlineAxisMainAxis() and rework some nsFrame code.
It turns out part 10 was actually needed, but Bug 1449838 had a significantly
better version of what that code does that was easy enough to backport to what
we have. As far as I can tell, this passes the relevant reftests now.
2022-08-24 09:27:32 +08:00
Jeremy Andrews
7527371d78 Issue #1986 - Use logical coordinates in flex containers.
This mostly reworks the way nsFlexContainerFrame handles things so that it can
deal with more than just height.
2022-08-24 09:27:13 +08:00
Jeremy Andrews
05d0cf7d47 Issue #1970 - Follow-up: Better fix for Unix that works on newer GCC.
My previous fix apparently only worked with GCC 7. Having that return at the
end doesn't seem to hurt anything on Windows, so I see no reason to ifdef it.

I don't remember where I heard this, but I vaguely remember hearing that
ending a function without a return statement may be undefined behavior that
differs between compilers and operating systems. If so, that would explain why
this has behaved so differently across platforms and compilers.
2022-08-24 09:26:55 +08:00
Moonchild
b18a680d4f Issue #1970 - Part 7: Restore proper spacing in select for CJK/asian
The issue is that select elements may contain some non-Latin characters that
need extra block-size to display than the one line-height calculated by using a
Latin font spec in the style.
Before this patch, when a control has an unconstrained block-size, we set
the element's block-size to one line-height in Reflow(), which is intended to
properly initialize `BlockReflowInput::mMinLineHeight` since it uses
`line-height:-moz-block-height`.

However, this simply prevents the display from choosing a larger block-size
after the reflow occurs. Previously, this discrepancy was absorbed by the extra
padding present to make select elements the same intrinsic size as buttons, but
since we did away with that, we're losing the extra space and the font glyphs
get clipped.

This patch fixes the issue by carrying the computed line height over to the
element's display so that its computed block-size is still unconstrained.
This way it can accommodate taller characters in the display text.

After this patch, a <select><option> containing non-Latin characters should have
the same block-size as <button>, and no characters should be clipped.
2022-08-04 14:25:30 +08:00
Moonchild
7203916733 Issue #1970 - Part 6: Rename CalcLineHeight(), and cache used line height
To better distinguish the calculation of line height (still present with args)
and simply getting the line height without args, it's now called GetLineHeight()
This also introduces `mLineHeight` to cache specifically calculated line heights
that aren't "auto" (which is a magic value), and it opens up the possibility to
override it in Part 7.
2022-08-04 14:25:13 +08:00
Moonchild
5ed7e7d56d Issue #1805 - Improve stack size limits for all targets.
This allows us to use a greater rendering depth for exceedingly-deep DOM trees
in layout, better matching what mainstream browsers are capable of. Note that
for 32-bit Windows the stack size MUST be set to larger than the default or Bad
Things Will Happen™ - we use 1.5 MB for this as a carefully-tuned value.

This needs to be capped specifically for JS use because some JavaScript
obfuscators deliberately trigger stack overflows and would lock up the browser
otherwise as long as there's still stack space to abuse. For web compatibility
we therefore limit this to 2MB in JS only (3x for ASAN) while still allowing
a greater depth for the layout engine.
2022-07-26 22:26:38 +08:00
Job Bautista
797ddb4d88 Issue #1916 - Part 2: Add a flag to allow FinishReflowChild to handle relative positioning, and convert the caller for which this makes sense.
Backported from Mozilla bug 1547759.
2022-06-22 09:01:41 +08:00
Job Bautista
0423d83560 Issue #1916 - Part 1: Convert flags passed to ReflowChild, FinishReflowChild, etc into an enum class.
Backported from Mozilla bug 1571250.
2022-06-22 09:01:25 +08:00
Moonchild
afbfbcb1e1 Issue #1914 - Implement white-space: break-spaces
This also simplifies GetCSSWhitespaceToCompressionMode (FFS with the function
names, Mozilla!) to be less fragile.
2022-06-13 09:10:57 +08:00
Brian Smith
d5c43d1d35 Issue #1829 - Readd code cleanup that is not Mac related that got clobbered by reverting Issue #1751 2022-05-04 10:01:23 +08:00
Brian Smith
13fcc4a046 Issue #1829 - Revert "Issue #1751" 2022-05-04 09:40:24 +08:00
FranklinDM
8a7587b401 Issue #21 - Remove use counters telemetry
This reverts Bug 968923 - Implement some equivalent of Chrome's use counters (on top of telemetry?)

For reference: https://bugzilla.mozilla.org/show_bug.cgi?id=968923
2022-04-28 10:43:09 +08:00
Moonchild
8d800b1cb0 Issue #21 - Remove Telemetry plumbing and fix build.
Note this won't give working applications. Requires FE changes and
additional js module changes (next part).
2022-04-28 10:25:48 +08:00
roytam1
92a1cc3139 Revert "Issue #21 - Remove use counters telemetry"
This reverts commit 8ca9db6b65.
2022-04-27 16:25:00 +08:00
FranklinDM
8ca9db6b65 Issue #21 - Remove use counters telemetry
This reverts Bug 968923 - Implement some equivalent of Chrome's use counters (on top of telemetry?)

For reference: https://bugzilla.mozilla.org/show_bug.cgi?id=968923
2022-04-27 16:15:31 +08:00
FranklinDM
e765c8edbf Issue #1370 - Follow-up: Give table wrapper boxes a special case during flex base size resolution, so that percent main-sizes can be respected
This is a workaround, based on https://bugzilla.mozilla.org/show_bug.cgi?id=1455976
2022-04-19 22:05:36 +08:00
FranklinDM
b315caec8a Issue #1370 - Part 4: Treat flex-basis: content as max-content
This uses a different approach and builds upon the refactoring made in the 576eb6ee01fb9ee3669cad634b26473c2886cab1.

Partially based on https://bugzilla.mozilla.org/show_bug.cgi?id=1374540
2022-04-19 21:56:39 +08:00
FranklinDM
9dc59c43f1 Issue #1370 - Part 3: Implement content keyword for flex-basis property
Partially based on https://bugzilla.mozilla.org/show_bug.cgi?id=1105111
2022-04-19 21:56:35 +08:00
FranklinDM
b6b20a04ec Issue #1370 - Part 2: Remove redundant special-case code for treating flex-basis enum values as 'auto' in vertical axis
Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1436881
2022-04-19 21:56:32 +08:00
FranklinDM
9d0492be56 Issue #1370 - Part 1: Refactor nsFrame to use a separate function for handling flex-basis
This removes the need to keep the `flex-basis` handling code of the ComputeSize* functions in sync since they both call the same function now for this purpose.
2022-04-19 21:56:29 +08:00
FranklinDM
5800b95cd0 Issue #1838 - Part 6: Re-resolve row-gap against the sum of row track sizes for auto-sized grid containers
Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1458902
2022-04-19 21:56:11 +08:00
FranklinDM
57d616da4c Issue #1838 - Part 5: Address follow-up issues to initial flexbox layout for (column|row)-gap properties
Notes:
* Bug 1473044 - Make flexbox cross size take row/column gap into account
https://bugzilla.mozilla.org/show_bug.cgi?id=1473044
* Bug 1473047 - Re-resolve row-gap percentages after intrinsic block size calculated
https://bugzilla.mozilla.org/show_bug.cgi?id=1473047
* Bug 1612401 - Prevent absolute-positioned children from contributing gap size to flexbox's inline-size
https://bugzilla.mozilla.org/show_bug.cgi?id=1612401
* Bug 1639627 - Make flex-container percent 'row-gap' values resolve to 0, when they're resolved against an indefinite block-size (essentially reverts Bug 1473047)
2022-04-19 21:56:07 +08:00
FranklinDM
d0cbf1a74f Issue #1838 - Part 4: Implement flexbox layout for (column|row)-gap properties
This implements flexbox layout for the gap properties without the refactoring work performed on `nsFlexContainerFrame`.

Partially based on https://bugzilla.mozilla.org/show_bug.cgi?id=1398483 and https://bugzilla.mozilla.org/show_bug.cgi?id=1454822

This excludes the second part of bug 1454822, the width caching implementation, because it is out of scope and currently causes unstable layout with `writing-mode: vertical-lr` (see bug 1709937).
2022-04-19 21:56:01 +08:00
FranklinDM
b4f2c83687 Issue #1838 - Part 2: Remove grid- prefix from grid-(column|row)-gap properties
This removes the `grid` prefix from the gap-related properties of grid since they are now part of the box alignment specification. Former grid-gap* properties were aliased to the unprefixed properties to maintain compatibility.

The previously multi-column layout only `column-gap` property has been modified to apply to the Grid layout (and Flexbox in a following commit), moving the `mColumnGap` member variable from `nsStyleColumn` to `nsStylePosition`.

Notes:
* Bug 1398537 - support for percent values in column-gap for multi-column layout landed as part of Issue #1230. However, it was incomplete because it did not update `nsRuleNode` to allow transformation of percentage values for `column-gap`. This was consequently fixed as part of this commit.
* Bug 1456166 - this might not apply because we don't have that devtools test in UXP
* `nsRuleNode`, `nsCSSParser`, `Declaration`, and other related classes were merged into Stylo. These should be taken into consideration when porting patches from Mozilla.

Partially based on https://bugzilla.mozilla.org/show_bug.cgi?id=1398482
2022-04-19 21:55:52 +08:00
FranklinDM
4f059d2c8b Issue #1838 - Part 1: Remove CSS grid preference
Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1398492
2022-04-19 21:55:49 +08:00
Moonchild
602bb0a877 Issue #3059 - Implement Selection.setBaseAndExtent() 2022-03-22 23:08:04 +08:00
Moonchild
94f3f356ed Issue #3050 - Follow-up: extend attribution mapping to resize and corner controls to allow themes to respond to scrollbar-width.
Also clean up the comments and whitespace a bit.
2022-03-22 23:06:12 +08:00
Moonchild
4bdd388989 Issue #3050 - Map scrollbar-width to an element attribute.
By mapping this to an attribute, this allows browser themes to respond to
the various available scrollbar width settings in CSS.
2022-03-22 23:05:57 +08:00
Moonchild
02c59100a8 Issue #1751 -- Remove XP_MACOSX conditionals from /layout 2021-05-05 10:29:02 +08:00
athenian200
618fa768c8 Issue #1757 - Reinstate "dom.details_element.enabled" preference
The removal of this preference was botched, all other surrounding plumbing changes appear to be working okay. The ability to use prefs to control this stylesheet might be useful in the future, so perhaps this is one of those "if it ain't broke, don't fix it" bugs where leaving well enough alone in the first place would have been the best choice.
2021-04-02 10:33:54 +08:00
Moonchild
1feafdc819 Issue #1053 - Remove mobile-specific graphics "optimizations" (=compromises) 2021-03-11 10:13:55 +08:00
Moonchild
7060aae250 Issue #1705 - Part 5: Implement scrollbar-width:none for all target platforms. 2021-01-14 22:19:56 +08:00
Moonchild
21f707390d Issue #1705 - Part 3: Rename ScrollbarStyles to ScrollStyles.
ScrollbarStyles contains values of overflow, (over)scroll-behavior, etc.
The only one which is marginally related to scroll _bars_ is overflow, which can
be used to hide scrollbar (by making an element not scrollable) or enforce the
scrollbar to display.

It makes more sense to be called ScrollStyles as it's mainly concerning behavior
of scrolling, not scrollbars. Also, with the addition of scrollbar width
properties, the current name can be confusing.
2021-01-14 22:19:53 +08:00
Moonchild
3765010635 Issue #1705 - Part 2: Add a ShowScrollbar enum to be used in ScrollReflowInput.
Overflow properties have two purposes:
1. controlling whether the scrollbar should be shown;
2. controlling whether the content is scrollable.

However, with the scrollbar-width property being added, scrollability and
presence of a scrollbar are no longer tied together.
This patch makes a separation between the value of overflow and the presence of
a scrollbar by making it clear that for ScrollReflowInput, we only care about
whether scrollbar should be shown.
This should make it easier to write the logic involving presence of the
scrollbar based on webdev choice.
2021-01-14 22:19:51 +08:00
Moonchild
7167c960d0 Issue #1053 - Part 2a: Remove android from /layout (partial)
This removes android code from base, build, forms, generic, inspector, style,
printing, tools and xul.
2021-01-01 10:01:05 +08:00
athenian200
a64dc2a367 Issue #1673 - Part 3: Bring minimum tab advance up to spec.
This provides a clearer rule for the minimum tab advance that brings us to alignment with the spec and both major browsers.
2020-11-06 09:42:26 +08:00
athenian200
b739e46f74 Issue #1673 - Part 2: Make tab-size animatable and fix typos.
There were a few typos in the previous patch and this patch also makes tab-size animatable which didn't really require much of a change at all.
2020-11-06 09:42:24 +08:00
athenian200
633d50eb3f Issue #1673 - Part 1: Allow tab-size to accept <length>.
Currently -moz-tab-size only accepts <number> values, and both Chrome and Firefox currently support <length> values and have for some time now. So with this you would be able to support sizes in px or em, for instance. This was implemented in Firefox 53 and was trivial to backport.
2020-11-06 09:42:23 +08:00
athenian200
1f68b25468 Issue #1668 - Part 2: Visited color and auto support for caret-color property.
Mozilla's original implementation of this failed a couple of tests, but this seems to solve all the problems. Basically, the caret-color wasn't able to be set differently based on whether a link was visited, and the auto value implementation was incomplete. The only test we fail now is the one where you have grey text on a grey background and the caret is supposed to be visible, but I think that may have been removed from the spec. Even if it wasn't, no other browser supports it anyway.
2020-10-23 10:05:52 +08:00
athenian200
33e50615d9 Issue #1668 - Part 1: Implement support for caret-color property.
This CSS property allows input carets (that blinking input cursor you see in text fields), to be given a custom color. This was implemented in Firefox 53, and it was such a minor feature that no one ever missed it, but I don't see any harm in implementing this.

https://bugzilla.mozilla.org/show_bug.cgi?id=1063162
2020-10-23 10:05:51 +08:00
Moonchild
e3f6690ee7 Issue #1671 - Unprefix ::-moz-selection
This actually keeps both pseudo-elements for now, since the prefixed version is
still used internally, but we need the unprefixed version for web compat.
Note: while unprefixing a non-spec-compliant pseudo here, it's exactly in line
with what other browsers do. Nobody is following the spec here and at least
we'll be doing what everyone else is with our unprefixed version.
2020-10-23 10:05:49 +08:00