Commit graph

622 commits

Author SHA1 Message Date
Ting-Yu Lin
edcb942efd Bug 1663822 Part 4 - Add a ComputeSizeFlags parameter to ReflowInput's constructor, and store it in ReflowInput. r=dholbert
Currently, to set ComputeSizeFlags, the caller uses an anonymous enum as
a parameter to ReflowInput constructor to set ReflowInputFlags fields,
and then ReflowInput creates a ComputeSizeFlags from the relevant
ReflowInputFlags fields in Init().

This patch simplifies this flags handover by adding ComputeSizeFlags
parameter to ReflowInput so that the caller can create the flags and
pass it to ReflowInput directly. The can also simplifies the process
needed to add a new ComputeSizeFlag.

We still need to store ComputeSizeFlags in ReflowInput since there's one
caller in `nsBlockFrame::ComputeFinalSize` wanting to checking
`ComputeSizeFlag::BClampMarginBoxMinSize`.

Note 1: ComputeSizeFlags is added only to the ReflowInput's constructor
that also takes parent ReflowInput. The other constructor's existing
callers don't need it.

Note 2: I don't bother adjust the value of DUMMY_PARENT_REFLOW_INPUT,
CALLER_WILL_INIT, and STATIC_POS_IS_CB_ORIGIN because they are going to
be converted into a enum class in a later patch.

This change shouldn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D89543
2020-09-11 18:17:51 +00:00
Oriol Brufau
1a38c1beab Bug 1655581 - [css-grid] Use min-content size for intrinsic maximums resolution. r=mats
By mistake the specification used to say that, for items spanning
multiple tracks, the growth limits of the tracks with an intrinsic max
track sizing function should grow to accommodate the minimum
contribution of the item.

But this was a mistake, because an intrinsic max track sizing function
can only be min-content or max-content. So instead of distributing the
minimum contribution, it should be the min-content contribution.

The spec has been fixed and there is a CSSWG resolution in
https://github.com/w3c/csswg-drafts/issues/4790

This patch fixes the problem by reverting 2b923d48ea7e. The change is
likely web compatible, since it only affects a rare edge case with
'minmax()' where the min sizing function is 'auto' or a fixed value
smaller than the min-content contribution, the max sizing function is
'min-content', and an item whose minimum contribution is forced to be
smaller than the min-content contribution, and spans multiple tracks.

Differential Revision: https://phabricator.services.mozilla.com/D89145
2020-09-11 12:42:07 +00:00
Simon Giesecke
96f3e7e019 Bug 1654992 - Use std::move instead of SwapElements where possible. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D84807
2020-08-04 11:27:07 +00:00
Noemi Erli
381fca9783 Backed out 4 changesets (bug 1654992, bug 1654991) for causing timeous in mask-opacity-1e.html
Backed out changeset 11f0f54c6e0a (bug 1654992)
Backed out changeset a353dd5b3f08 (bug 1654991)
Backed out changeset 6a7964ba549f (bug 1654991)
Backed out changeset cf3bfb91d98c (bug 1654991)
2020-08-03 22:09:36 +03:00
Simon Giesecke
032d2ac9d3 Bug 1654992 - Use std::move instead of SwapElements where possible. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D84807
2020-08-03 14:54:18 +00:00
Brad Werth
b38e6bdb3f Bug 1648774 Part 1: Make GetFlexFrameWithComputedInfo work for nsFieldSetFrame. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D84626
2020-07-23 19:29:37 +00:00
Simon Giesecke
cd8b8939b9 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
Kagami Sascha Rosylight
8be8aebf9d Bug 1647525 - Use HasAnyStateBits() in nsGridContainerFrame r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D81203
2020-06-27 13:17:04 +00:00
Ting-Yu Lin
675da8e9a4 Bug 1648673 - Remove duplicate CSSOrderAwareFrameIteratorT typedefs in nsGridContainerFrame.h r=dholbert
* It's easier to maintain the type aliases of in one place, i.e.
CSSOrderAwareFrameIterator.h, and the iterator's header itself doesn't
include a lot of headers that add complex dependencies to
nsGridContainerFrame.h.

* Make "jump to definition" functionality in editors work
correctly (rather than just jumping to those declarations.)

Differential Revision: https://phabricator.services.mozilla.com/D81281
2020-06-26 16:51:40 +00:00
Emily McDonough
9c4930c11b Bug 1633737 - Fix asserts and array accesses for oversized grid tracks with repeat-auto r=emilio
Handle grid track lists that are too large in CalculateRepeatFillCount. Check
for repeat tracks that begin or end past the maximum track limit in
InitRepeatTracks, and handle the possible size mismatch in nsComputedDOMStyle.

This may result in there being fewer than the maximum number of tracks again
after removing empty tracks in a repeat(auto-fit), but only limiting the track
count after removing empty tracks would leave the number of repeat tracks
unbounded (or require a separate limit on just the repeat track count).

Differential Revision: https://phabricator.services.mozilla.com/D76191
2020-06-24 18:25:08 +00:00
Brindusan Cristian
8246b23171 Backed out changeset a59280f412c0 (bug 1633737) for crashtest assertion failures at nsGridContainerFrame.cpp. CLOSED TREE 2020-06-18 04:16:09 +03:00
Emily McDonough
4b9ef7886e Bug 1633737 - Fix asserts and array accesses for oversized grid tracks with repeat-auto r=emilio
Handle grid track lists that are too large in CalculateRepeatFillCount. Check
for repeat tracks that begin or end past the maximum track limit in
InitRepeatTracks, and handle the possible size mismatch in nsComputedDOMStyle.

This may result in there being fewer than the maximum number of tracks again
after removing empty tracks in a repeat(auto-fit), but only limiting the track
count after removing empty tracks would leave the number of repeat tracks
unbounded (or require a separate limit on just the repeat track count).

Differential Revision: https://phabricator.services.mozilla.com/D76191
2020-06-17 23:25:14 +00:00
Brad Werth
bec018af01 Bug 1644498: Transition devtools nsFrameStateBits to nsIFrame.h r=heycam
This patch takes the flags NS_STATE_GRID_GENERATE_COMPUTED_VALUES and
NS_STATE_FLEX_GENERATE_COMPUTED_VALUES and combines them into a single new
flag that is defined in nsIFrame.h, with accessors.

Differential Revision: https://phabricator.services.mozilla.com/D78978
2020-06-10 05:03:35 +00:00
Csoregi Natalia
205b2ad0b6 Backed out changeset f73a200460d9 (bug 1644498) for crashes on nsGridContainerFrame. CLOSED TREE 2020-06-10 03:54:24 +03:00
Brad Werth
a2bfa24957 Bug 1644498: Transition devtools nsFrameStateBits to nsIFrame.h r=heycam
This patch takes the flags NS_STATE_GRID_GENERATE_COMPUTED_VALUES and
NS_STATE_FLEX_GENERATE_COMPUTED_VALUES and combines them into a single new
flag that is defined in nsIFrame.h, with accessors.

Differential Revision: https://phabricator.services.mozilla.com/D78978
2020-06-09 23:01:00 +00:00
Simon Giesecke
ca2d0aaa68 Bug 1644403 - Fix inconsistent uses of CopyableAutoTArray and Clone. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D78893
2020-06-09 14:27:20 +00:00
Ting-Yu Lin
e3ba3c551e Bug 1643173 Part 2 - Unify GetDisplayFlag helpers for flex and grid items. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D78167
2020-06-05 02:52:58 +00:00
Ting-Yu Lin
1022daa063 Bug 1643173 Part 1 - Convert enum nsIFrame::DISPLAY_CHILD_* to enum class. r=dholbert
The modifications are all straightforward conversion except the one in
nsMathMLContainerFrame, where it is simplified by calling the equivalent
BuildDisplayListForInline() helper.

Differential Revision: https://phabricator.services.mozilla.com/D78166
2020-06-05 02:52:05 +00:00
Ting-Yu Lin
72644413c0 Bug 1641739 - Reduce the support child list types for flex / grid container's frame list manipulation methods. r=mats
These flex / grid's methods are implemented by delegating to
nsContainerFrame's methods. We shouldn't assume they can support more
child list types than the ones supported in nsContainerFrame's methods.

- NoteNewChildren is a helper for flex and grid's AppendFrame and
InsertFrames, and nsContainerFrame::{AppendFrame,InsertFrames} supports
only kPrincipalList and kNoReflowPrincipalList.

- nsContainerFrame::RemoveFrame supports only kPrincipalList and
kNoReflowPrincipalList.

- nsContainerFrame::SetInitialChildList supports only kPrincipalList and
kBackdropList.

Differential Revision: https://phabricator.services.mozilla.com/D77391
2020-06-01 18:22:03 +00:00
Ting-Yu Lin
fae28a9fe1 Bug 1640275 Part 1 - Move some nsGridContainerFrame's helper methods to nsContainerFrame. r=mats
In the next part, I'll extend these helpers, and use them in
nsFlexContainerFrame.

Differential Revision: https://phabricator.services.mozilla.com/D77203
2020-05-28 18:03:11 +00:00
Ting-Yu Lin
b510e66915 Bug 1622935 Part 2 - Move nsGridContainerFrame's NormalizeChildLists() and related helpers to nsContainerFrame. r=mats
Also, add relevant bits to be able to use them in the flex container.

Differential Revision: https://phabricator.services.mozilla.com/D73166
2020-05-01 23:34:22 +00:00
Emily McDonough
143b38623d Bug 1629575 - [css-grid] Initialize LineNameMap::mTemplateLinesEnd correctly also when a repeat(auto-fill/fit) has more than one track. r=mats
This only occurred when a grid with a repeat with multiple values was used.
Also Add crashtests for this case, and update some comments on LineNameMap's
fields while we are here.

Differential Revision: https://phabricator.services.mozilla.com/D71242
2020-05-07 18:27:30 +00:00
Bogdan Tara
5e05e2ded9 Backed out changeset 0c1494c8c04a (bug 1629575) by alaskanemily's request 2020-05-07 03:07:20 +03:00
Emily McDonough
80a9e4f320 Bug 1629575 - Fix incorrect grid template size in the line name map r=mats
This only occurred when a grid with a repeat with multiple values was used.

Differential Revision: https://phabricator.services.mozilla.com/D71242
2020-05-06 22:20:09 +00:00
Emily McDonough
1943cf3dcf Bug 1628041 - Use fill length rather than index to indicate a repeat(auto) in subgrid from Servo r=mats
Differential Revision: https://phabricator.services.mozilla.com/D70066
2020-05-06 19:35:03 +00:00
Simon Giesecke
b8e5abc46a Bug 1626570 - Improve handling of copying arrays in layout/generic/. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D72353
2020-05-05 10:11:01 +00:00
Mats Palmgren
fa99004b91 Bug 1633720 - [css-grid-2] Adjust the grid area stored in the Subgrid property as well for removed 'auto-fit' tracks in the parent. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D73007
2020-04-30 11:34:20 +00:00
Mats Palmgren
3622105887 Bug 1607954 part 2 - [css-grid][css-align] Implement Masonry layout. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D67062
2020-04-28 01:18:47 +00:00
Simon Giesecke
2d8c4390b7 Bug 1628715 - Part 15: Replace MOZ_NONNULL_RETURN by returning NotNull<elem_type*>. r=xpcom-reviewers,necko-reviewers,dragana,nika
Differential Revision: https://phabricator.services.mozilla.com/D71300
2020-04-24 13:35:27 +00:00
L. David Baron
b4556207cc Bug 1631941 - Add DEBUG-only mWritingMode to mozilla::LogicalSides. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D71885
2020-04-22 23:52:08 +00:00
Stefan Hindli
ed13e122ee Backed out 3 changesets (bug 1631941) for mass build bustages CLOSED TREE
Backed out changeset 8a7e21f2b5f9 (bug 1631941)
Backed out changeset 6a53d6f1ec95 (bug 1631941)
Backed out changeset 91ac0b7e571b (bug 1631941)
2020-04-23 02:14:30 +03:00
L. David Baron
129af7be9b Bug 1631941 - Add DEBUG-only mWritingMode to mozilla::LogicalSides. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D71885
2020-04-22 17:54:28 +00:00
Stefan Hindli
145ea7c2cf Backed out 3 changesets (bug 1631941) for causing valgrind bustages in /builds/worker/workspace/obj-build/dist/include/mozilla/WritingModes CLOSED TREE
Backed out changeset 17391a8c2a05 (bug 1631941)
Backed out changeset b0b425ffb6e9 (bug 1631941)
Backed out changeset f4c1d7dcca50 (bug 1631941)
2020-04-22 20:13:06 +03:00
L. David Baron
304574d922 Bug 1631941 - Add DEBUG-only mWritingMode to mozilla::LogicalSides. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D71885
2020-04-22 15:55:54 +00:00
Ting-Yu Lin
7323697f18 Bug 1625362 Part 3 - Extract grid container's PushIncompleteChildren logic, and move it to nsContainerFrame. r=mats
I left all the bits that related to grid container, such as setting
aStatus, NS_STATE_GRID_DID_PUSH_ITEMS, and aState.mIter in
nsGridContainerFrame::ReflowRowsInFragmentainer().

Differential Revision: https://phabricator.services.mozilla.com/D68492

--HG--
extra : moz-landing-system : lando
2020-04-15 18:31:35 +00:00
Ting-Yu Lin
a2e0d00564 Bug 1625362 Part 2 - Move some helpers manipulating overflow lists from nsGridContainerFrame to nsContainerFrame. r=mats
We can utilize these helpers to implement flex item fragmentation.

Differential Revision: https://phabricator.services.mozilla.com/D68491

--HG--
extra : moz-landing-system : lando
2020-04-15 18:31:33 +00:00
Ting-Yu Lin
97c3b1d8cb Bug 1625362 Part 1 - Move ReparentFrame and ReparentFrames into nsContainerFrame. r=mats
We have duplicated ReparentFrame and ReparentFrames define in both
nsBlockFrame and nsGridContainerFrame. We should move them into
nsContainerFrame.

Differential Revision: https://phabricator.services.mozilla.com/D68490

--HG--
extra : moz-landing-system : lando
2020-04-15 18:31:25 +00:00
Emily McDonough
a076865928 Bug 1628837 - Add subgrid property address to nsGridContainerFrame frame dump output r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D70436

--HG--
extra : moz-landing-system : lando
2020-04-09 21:25:12 +00:00
Emily McDonough
9ae2ce3fae Bug 1624756 - Use EmplaceBack instead of AppendElement(std::make_pair) in TrackSizingFunction::ExpandNonRepeatAutoTracks r=mats
Differential Revision: https://phabricator.services.mozilla.com/D68130

--HG--
extra : moz-landing-system : lando
2020-03-31 16:36:26 +00:00
Emily McDonough
38fbd0aba9 Bug 1625051 Part 1 - Fix calculation of maximum repeat count for grid repeat(auto) r=mats
Differential Revision: https://phabricator.services.mozilla.com/D68488

--HG--
extra : moz-landing-system : lando
2020-03-30 23:46:41 +00:00
André Bargull
2712714d84 Bug 1625138 - Part 35: Replace mozilla::TrueType with std::true_type. r=froydnj,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D68554

--HG--
extra : moz-landing-system : lando
2020-03-28 13:57:20 +00:00
Ting-Yu Lin
b3c3bf9bc9 Bug 1624514 Part 2 - Generalize nsIFrame::ContentBSize() to be ContentSize(). r=AlaskanEmily
To get the logical content size of a frame, some callers use
GetContentRectRelativeToSelf().Size() and then convert it to
LogicalRect. We really should generalize ContentBSize(), and provide
ContentSize() for such purpose.

Differential Revision: https://phabricator.services.mozilla.com/D68065

--HG--
extra : moz-landing-system : lando
2020-03-25 18:12:25 +00:00
Emily McDonough
d3cac52f73 Bug 1341507 part 6 - Enable multiple grid repeat values in Servo r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D60931

--HG--
extra : moz-landing-system : lando
2020-03-19 22:11:48 +00:00
Emily McDonough
e8a1c53e39 Bug 1341507 part 5 - Support multiple tracks in repeat-auto in line name maps r=mats
This includes when using subgrid layout.

Differential Revision: https://phabricator.services.mozilla.com/D60930

--HG--
extra : moz-landing-system : lando
2020-03-19 22:11:45 +00:00
Emily McDonough
e2096a565d Bug 1341507 part 4 - Add auto-fill length field to line name lists returned from Servo. r=mats,emilio
Rename fill_idx to fill_start, to indicate it is not a single value but a
range. Also change a numeric_limits<>::max() involving the fill_start to use
decltype() to ensure its type matches that of the auto-generated structure's
field, while we're touching that code.

The test to ensure only a single repeat value is allowed will be removed by a
later commit.

Differential Revision: https://phabricator.services.mozilla.com/D60929

--HG--
extra : moz-landing-system : lando
2020-03-19 22:11:43 +00:00
Emily McDonough
e478232272 Bug 1341507 part 3 - Support multiple repeat values when getting the sizing of a track by index. r=mats
Differential Revision: https://phabricator.services.mozilla.com/D60928

--HG--
extra : moz-landing-system : lando
2020-03-19 22:11:35 +00:00
Emily McDonough
7199fa5871 Bug 1341507 part 2 - Take multiple repeat track sizes into account when computing how many repetitions will fit. r=mats
This also means that the result of CalculateRepeatFillCount is specified to be
a number of repetitions of all repeat tracks, not the total number of tracks.

Differential Revision: https://phabricator.services.mozilla.com/D60927

--HG--
extra : moz-landing-system : lando
2020-03-19 22:35:48 +00:00
Stefan Hindli
f3854a78ed Backed out 7 changesets (bug 1341507) for mochitest failures in dom/grid/test/chrome/test_grid_repeat_auto_fill.html CLOSED TREE
Backed out changeset e4e968fabe2b (bug 1341507)
Backed out changeset 6cafdef7eb79 (bug 1341507)
Backed out changeset eff4ad47440c (bug 1341507)
Backed out changeset 55432ee0cd4b (bug 1341507)
Backed out changeset e798ebf91eca (bug 1341507)
Backed out changeset 08d38f05b160 (bug 1341507)
Backed out changeset 6b35af9ecb38 (bug 1341507)
2020-03-19 02:49:17 +02:00
Emily McDonough
8cc2cae246 Bug 1341507 part 6 - Enable multiple grid repeat values in Servo r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D60931

--HG--
extra : moz-landing-system : lando
2020-03-18 22:44:41 +00:00
Emily McDonough
cd299acef9 Bug 1341507 part 5 - Support multiple tracks in repeat-auto in line name maps r=mats
This includes when using subgrid layout.

Differential Revision: https://phabricator.services.mozilla.com/D60930

--HG--
extra : moz-landing-system : lando
2020-03-18 23:01:23 +00:00
Emily McDonough
3496717c21 Bug 1341507 part 4 - Add auto-fill length field to line name lists returned from Servo. r=mats,emilio
Rename fill_idx to fill_start, to indicate it is not a single value but a
range. Also change a numeric_limits<>::max() involving the fill_start to use
decltype() to ensure its type matches that of the auto-generated structure's
field, while we're touching that code.

The test to ensure only a single repeat value is allowed will be removed by a
later commit.

Differential Revision: https://phabricator.services.mozilla.com/D60929

--HG--
extra : moz-landing-system : lando
2020-03-18 22:44:36 +00:00
Emily McDonough
848eb5a6ca Bug 1341507 part 3 - Support multiple repeat values when getting the sizing of a track by index. r=mats
Differential Revision: https://phabricator.services.mozilla.com/D60928

--HG--
extra : moz-landing-system : lando
2020-03-18 22:44:34 +00:00
Emily McDonough
28826122d4 Bug 1341507 part 2 - Take multiple repeat track sizes into account when computing how many repetitions will fit. r=mats
This also means that the result of CalculateRepeatFillCount is specified to be
a number of repetitions of all repeat tracks, not the total number of tracks.

Differential Revision: https://phabricator.services.mozilla.com/D60927

--HG--
extra : moz-landing-system : lando
2020-03-18 22:59:58 +00:00
Chris Fronk
d5b004443b Bug 1143478 - Rename mozilla::Pair to CompactPair. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D64511

--HG--
rename : mfbt/Pair.h => mfbt/CompactPair.h
extra : moz-landing-system : lando
2020-03-17 12:42:12 +00:00
Mats Palmgren
796ab8fde7 Bug 1613210 - Delegate intrinsic size calls to the first continuation for nsGridContainerFrames. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D65643

--HG--
extra : moz-landing-system : lando
2020-03-17 09:55:39 +00:00
Ting-Yu Lin
afe9123179 Bug 1622008 Part 3 - Remove nsPresContext* and PresShell* from the argument list of some continuing-frame-creation methods. r=dholbert
Both PresShell() and PresContext() are cached in nsIFrame. This
simplifies the setup for the callers to
nsCSSFrameConstructor::CreateContinuingFrame().

Differential Revision: https://phabricator.services.mozilla.com/D66600

--HG--
extra : moz-landing-system : lando
2020-03-12 21:50:23 +00:00
shindli
b02b3a6e1a Backed out changeset a08637fb30c8 (bug 1143478) for causing bustages in /builds/worker/checkouts/gecko/ipc/mscom/Registration.cpp CLOSED TREE
--HG--
rename : mfbt/CompactPair.h => mfbt/Pair.h
2020-03-11 14:30:54 +02:00
Chris Fronk
a27e438c2d Bug 1143478 - Rename mozilla::Pair to CompactPair. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D64511

--HG--
rename : mfbt/Pair.h => mfbt/CompactPair.h
extra : moz-landing-system : lando
2020-03-11 12:18:13 +00:00
Mats Palmgren
e41033bc70 Bug 1618312 - [css-grid] Use the outermost frame to check the computed position value since we don't inherit that to anonymous frames. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D64851

--HG--
extra : moz-landing-system : lando
2020-03-02 15:51:24 +00:00
Mats Palmgren
7003a28618 Bug 1618351 - Floor subgrid auto-fill repeat count at zero to avoid underflow of unsigned integer mRepeatAutoEnd. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D64637

--HG--
extra : moz-landing-system : lando
2020-02-27 21:44:04 +00:00
Mats Palmgren
29b084bccb Bug 1608851 - Only an actual <track-list> guarantees a track (not an ignored 'subgrid' value). r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D64452

--HG--
extra : moz-landing-system : lando
2020-02-27 05:47:59 +00:00
Martin McNickle
30c6161dca Bug 1615380 - Part 2 - Use the cbindgen output for GridAutoFlow directly in gecko. r=emilio
Depends on D62787

Differential Revision: https://phabricator.services.mozilla.com/D62910

--HG--
extra : moz-landing-system : lando
2020-02-14 15:48:10 +00:00
Chris Fronk
113fa0f94e Bug 1614432 - Remove redundant nested #IF r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D62529

--HG--
extra : moz-landing-system : lando
2020-02-12 02:28:30 +00:00
Emilio Cobos Álvarez
c5c0ef9787 Bug 1613349 - Rename nsIFrame::DeleteProperty to RemoveProperty. r=dholbert
As it doesn't necessarily call delete and that may be confusing.

Differential Revision: https://phabricator.services.mozilla.com/D61764

--HG--
extra : moz-landing-system : lando
2020-02-06 16:06:49 +00:00
Daniel Holbert
ae192ec3a5 Bug 1613192: Fix non-unified build bustage in layout/{base,generic} directories. r=TYLin
Summary of the changes/reasons:

- LayoutTelemetryTools.h directly uses several types whose headers it needs to
  include. (These includes were present in its .cpp file; I'm migrating them
  from there to the .h file, and I'm adding a new include for "Saturate.h" to
  provide the SaturateUint8 type.)

- LayoutTelemetryTools.cpp needs an include for MainThreadUtils.h, to provide
  NS_IsMainThread().

- StaticPresData.cpp needs an include for ServoUtils.h, to provide
  AssertIsMainThreadOrServoFontMetricsLocked().

- ZoomConstraintsClient.h needs a forward-decl for mozilla::dom::Document since
  it uses a pointer of that type in a function-decl.

- ScrollSnap.h needs forward-decls of nsPoint/nsRect for some references to
  those types in a method signature.

- nsGridContainerFrame.cpp needs an include for nsBoxLayoutState.h since it
  uses that type (it instantiates a nsBoxLayoutState instance).

- nsPlaceholderFrame.cpp needs a "using" decl for the mozilla::dom namespace in
  order to use the un-namespace-prefixed "Element" type.

Differential Revision: https://phabricator.services.mozilla.com/D61603

--HG--
extra : moz-landing-system : lando
2020-02-04 19:34:51 +00:00
Emilio Cobos Álvarez
4812f9408a Bug 1611583 - Use cbindgen for css-align types. r=dholbert
This provides stronger typing and removes a bunch of subtle constants matching.

Differential Revision: https://phabricator.services.mozilla.com/D61058

--HG--
extra : moz-landing-system : lando
2020-01-31 00:56:49 +00:00
Emily McDonough
20c74bb15f Bug 1611950 - Make constructor of CellMap::Cell constexpr r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D61179

--HG--
extra : moz-landing-system : lando
2020-01-29 06:34:48 +00:00
Mats Palmgren
df9c8cc274 Bug 1606516 - Inhibit subgridding a parent axis that has no tracks. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D60566

--HG--
extra : moz-landing-system : lando
2020-01-25 02:45:31 +00:00
Mats Palmgren
14fdc03837 Bug 1610362 - Floor track sizes to zero after adjusting for subgrid margin+border+padding. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D60565

--HG--
extra : moz-landing-system : lando
2020-01-25 02:20:28 +00:00
Emilio Cobos Álvarez
aa3a33a08a Bug 1597055 - Don't stretch grid items with non-auto block-size. r=mats
Per the resolution in https://github.com/w3c/csswg-drafts/issues/4525.

Differential Revision: https://phabricator.services.mozilla.com/D60675

--HG--
extra : moz-landing-system : lando
2020-01-25 20:14:59 +00:00
Emilio Cobos Álvarez
5cd5e6f148 Bug 1609996 - Remove mozilla::Swap in favor of std::swap. r=froydnj
Now mfbt/Move.h is empty except for that excellent comment about move
semantics... Should we put it somewhere else and delete the header as a
follow-up? Or just delete the header and carry on?

Differential Revision: https://phabricator.services.mozilla.com/D60297

--HG--
extra : moz-landing-system : lando
2020-01-20 16:17:06 +00:00
Emily McDonough
278cadcc1e Bug 1341507 - Refactor auto-fit empty track calculations into a separate method r=mats
Differential Revision: https://phabricator.services.mozilla.com/D58026

--HG--
extra : moz-landing-system : lando
2020-01-16 04:27:33 +00:00
Emily McDonough
12a9d5c07e Bug 1606485 - Check containing parent frames for 'contain:layout/paint' in grid container frames. r=emilio
This prevents grid container frames from being considered subgrid (even when
they have contain:layout/paint) when they are themselves a grid item of a
contain grid.

Differential Revision: https://phabricator.services.mozilla.com/D59790

--HG--
extra : moz-landing-system : lando
2020-01-14 01:06:56 +00:00
Emily McDonough
be59ef32a5 Bug 1607952 - Avoid using both std::move and a method on the same variable for getting the number of explicit tracks for ComputedGridTrackInfo r=emilio
The order of argument evaluation is implementation-defined, so we can't trust
whether the .Length() or the std::move() will get executed first. This is OK
right now since the constructor takes the argument by rvalue and so it can't be
emptied out before the .Length() call. However, a change to the types in the
constructor's argument list could make this still compile, but then depend on
compiler-dependent argument evaluation order to get the correct result.

Differential Revision: https://phabricator.services.mozilla.com/D59238

--HG--
extra : moz-landing-system : lando
2020-01-09 00:29:08 +00:00
Emily McDonough
9108c52192 Bug 1341507 - Refactor TrackSizingFunctions::mRepeatEndDelta to be a getter function rather than a variable. r=emilio
The information in it is always derivable from the values of mRepeatAutoStart
and mRepeatAutoEnd. Additionally, its value is used in some cases where it has
not yet been set properly (such as CalculateRepeatFillCount).

This works out currently because the default value is zero we only accept
repeat(auto-fill, ...) and repeat(auto-fit, ...) CSS values that have a single
element in the repeat. In that case, zero is the correct value for
RepeatEndDelta.

Differential Revision: https://phabricator.services.mozilla.com/D58871

--HG--
extra : moz-landing-system : lando
2020-01-07 00:50:58 +00:00
Chris Peterson
406763af7f Bug 1570499 - Part 1: Replace MOZ_FALLTHROUGH macro with C++17's [[fallthrough]] attribute. r=froydnj
This changeset is a simple find and replace of `MOZ_FALLTHROUGH` and `[[fallthrough]]`.

Unfortunately, the MOZ_FALLTHROUGH_ASSERT macro (to assert on case fallthrough in debug builds) is still necessary after switching from [[clang::fallthrough]] to [[fallthrough]] because:

* MOZ_ASSERT(false) followed by [[fallthrough]] triggers a -Wunreachable-code warning in DEBUG builds
* but MOZ_ASSERT(false) without [[fallthrough]] triggers a -Wimplicit-fallthrough warning in NDEBUG builds.

Differential Revision: https://phabricator.services.mozilla.com/D56440

--HG--
extra : moz-landing-system : lando
2019-12-20 07:16:43 +00:00
Daniel Holbert
693c08b645 Bug 1593060: When measuring size of XUL in CSS grid, use the GetXULPrefSize API instead of an explicit reflow. r=mats
Note that the GetXULPrefSize API might still do a "::BoxReflow" under the hood,
inside its call to RefreshSizeCache.

Also: we can't use GetLogicalUsedMargin() in this special case, because the
child may not have been reflowed (which is what populates the "used margin"
frame property).  So instead, we pull the margin off of the reflow state.
As noted in the code-comment alongside that call, this won't work with
percent margins, but hopefully we can just avoid those in our frontend code
that uses XUL-in-grid-items.

Also, this patch makes the grid call ReflowChild() on its grid items using
a loose guess at their position, rather than at position 0,0. This helps
popup frames figure out their size during reflow and size their children
properly.

Differential Revision: https://phabricator.services.mozilla.com/D54886

--HG--
extra : moz-landing-system : lando
2019-12-04 03:37:09 +00:00
Emilio Cobos Álvarez
816c826751 Bug 1596361 - Ensure nsGridContainerFrame::GetGridFrameWithComputedInfo really returns a frame with computed info. r=mats
I couldn't repro this with the STR in the bug, but I can repro by inspecting a
grid in print preview, where we don't properly honor the re-reflow request
because $reasons.

Differential Revision: https://phabricator.services.mozilla.com/D55264

--HG--
extra : moz-landing-system : lando
2019-11-29 20:24:26 +00:00
Boris Chiou
41488d1a22 Bug 1593796 - Apply the correct specified implicit size. r=mats
Per the spec, if multiple track sizes are given, the pattern is repeated as
necessary to find the size of the implicit tracks:
1. The first implicit grid track after the explicit grid receives the first
   specified size, and so on forwards.
2. The last implicit grid track before the explicit grid receives the last
   specified size, and so on backwards.

We use a positive index of the auto track sizes for (1) and a negative index
for (2), so we can apply the correct specified implicit size.

Differential Revision: https://phabricator.services.mozilla.com/D52265

--HG--
extra : moz-landing-system : lando
2019-11-12 22:28:09 +00:00
L. David Baron
449f8593f0 Bug 1584018 - Make flex and grid code indicate that its block resizes can affect basis for percentages. r=dholbert,mats
Differential Revision: https://phabricator.services.mozilla.com/D50511

--HG--
extra : moz-landing-system : lando
2019-10-24 22:35:46 +00:00
Mats Palmgren
a860dc10ba Bug 1234311 part 2 - [css-grid-2] Implement 'grid-template-rows/columns' resolved value correctly for subgrid. r=dholbert
This implements the resolution and adds WPTs for:
https://github.com/w3c/csswg-drafts/issues/4362

Differential Revision: https://phabricator.services.mozilla.com/D49027

--HG--
extra : moz-landing-system : lando
2019-10-12 17:16:02 +00:00
Mats Palmgren
b15d020bef Bug 1581106 part 3 - [css-grid-2] Implement 'repeat(auto-fill, <line-names>)' in subgridded axis. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D46895

--HG--
extra : moz-landing-system : lando
2019-09-30 17:32:52 +00:00
Mats Palmgren
7d90d80ff0 Bug 1581106 part 2 - Simplify LineNameMap ctor by deducing track clamping bounds instead of passing them as params (idempotent change). r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D46373

--HG--
extra : moz-landing-system : lando
2019-09-30 17:51:28 +00:00
Mats Palmgren
bb73a535cf Bug 1581106 part 1 - Remove unused aNumRepeatTracks param (idempotent change). r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D46372

--HG--
extra : moz-landing-system : lando
2019-09-30 17:50:55 +00:00
Mats Palmgren
ae1542ae49 Bug 1549620 - [css-grid] Take box-sizing:border-box into account when calculating the input sizes for repeat(auto-fill/fit) track count. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D45708

--HG--
extra : moz-landing-system : lando
2019-09-14 00:17:16 +00:00
Mats Palmgren
78bd45b6de Bug 1560397 - [css-grid] If a repeat(auto-fill/fit) track starts outside the clamped grid then treat it as not having a auto-fill/fit at all. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D45782

--HG--
extra : moz-landing-system : lando
2019-09-13 12:41:00 +00:00
Mats Palmgren
e6e6a5947c Bug 1579671 - Remove assertion that fails for subgrid. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D45235

--HG--
extra : moz-landing-system : lando
2019-09-13 02:47:43 +00:00
L. David Baron
99fc596f62 Bug 1547759 - Ensure that we call ApplyRelativePositioning after the frame's new size has been set so it works correctly for RTL. r=jfkthame,dholbert
Differential Revision: https://phabricator.services.mozilla.com/D40568

--HG--
extra : moz-landing-system : lando
2019-08-08 20:04:40 +00:00
L. David Baron
1488be9417 Bug 1571250 - Convert flags passed to ReflowChild, FinishReflowChild, SyncFrameViewAfterReflow and from GetXULLayoutFlags / GetLayoutFlags into an enum class. r=TYLin
It seems better to convert this before adding a new flag (in bug
1547759) and risking replacing the wrong 0 with a flag.

Differential Revision: https://phabricator.services.mozilla.com/D40562

--HG--
extra : moz-landing-system : lando
2019-08-08 19:48:19 +00:00
Boris Chiou
e158ad1169 Bug 1339672 - Support multiple track sizes for grid-auto-{columns|rows}. r=emilio,mats
Support `<track-size>+` on the implicit track sizing properties,
grid-auto-columns and grid-auto-rows.

Differential Revision: https://phabricator.services.mozilla.com/D38408

--HG--
extra : moz-landing-system : lando
2019-08-06 18:32:16 +00:00
Emilio Cobos Álvarez
bbb4b8dac6 Bug 1519958 - followup: Fix bustage in 32-bit builds and rust unit tests. r=me
CLOSED TREE
2019-08-05 22:53:35 +02:00
Emilio Cobos Álvarez
30fc8c8c4d Bug 1519958 - Improve stack size of grid templates and re-enable style struct size assertions disabled in the previous patch. r=boris
This re-enables the assertion which was disabled on the previous patch by doing
a bit of boxing around.

Differential Revision: https://phabricator.services.mozilla.com/D36599
2019-08-05 22:13:33 +02:00
Emilio Cobos Álvarez
1f3d6c04f2 Bug 1519958 - Refactor grid types to preserve repeat() at computed value time and use cbindgen. r=mats,boris
I'm _really_ sorry for the size of the patch. I tried to do this in two steps
but it was a lot of work and pretty ugly.

This patch makes us use cbindgen for grid-template-{rows,columns}, in order to:

 * Make us preserve repeat() at computed-value time. This is per spec since
   interpolation needs to know about repeat(). Except for subgrid, which did the
   repeat expansion at parse-time and was a bit more annoying (plus it doesn't
   really animate yet so we don't need it to comply with the spec).

 * Tweaks the WPT tests for interpolation to adopt the resolution at:
   https://github.com/w3c/csswg-drafts/issues/3503.

Trade-off here, as this patch stands, is that this change makes us use less
long-living memory, since we expand repeat() during layout, but at the cost of a
bit of CPU time during layout (conditional on the property applying though,
which wasn't the case before). It should be very easy to store a cached version
of the template, should this be too hot (I expect it isn't), or to change the
representation in other ways to optimize grid layout code if it's worth it.

Another trade-off: I've used SmallPointerArray to handle line-name merging,
pointing to the individual arrays in the style data, rather than actually
heap-allocating the merged lists. This would also be pretty easy to change
should we measure and see that it's not worth it.

This patch also opens the gate to potentially improving memory usage in some
other ways, by reference-counting line-name lists for example, though I don't
have data that suggests it is worth it.

In general, this patch makes much easier to tweak the internal representation of
the grid style data structures. Overall, I think it's a win, the amount of magic
going on in that mako code was a bit huge; it took a bit to wrap my head around
it.

This patch comments out the style struct size assertions. They will be
uncommented in a follow-up patch which contains some improvements for this type,
which are worth getting reviewed separately.

Also, this patch doesn't remove as much code as I would've hoped for because of
I tried not to change most of the dom/grid code for inspector, but I think a
fair bit of the nsGridContainerFrame.cpp code that collects information for it
can be simplified / de-copy-pasted to some extent. But that was a pre-existing
problem and this patch is already quite massive.

Differential Revision: https://phabricator.services.mozilla.com/D36598
2019-08-05 22:13:21 +02:00
L. David Baron
ce547cd6f5 Bug 1566945 - Add a parameter to nsContainerFrame::InsertFrames for aPrevFrame's line box. r=dholbert
For now, always pass null, except when passing it through from one
overload to another.

Differential Revision: https://phabricator.services.mozilla.com/D38389

--HG--
extra : moz-landing-system : lando
2019-07-17 23:34:45 +00:00
Sylvestre Ledru
e77bfc655d Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D38057

--HG--
extra : moz-landing-system : lando
2019-07-16 07:33:44 +00:00
Sylvestre Ledru
131d0c6a02 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D35622

--HG--
extra : moz-landing-system : lando
2019-07-06 08:18:28 +00:00
Emilio Cobos Álvarez
0a4d4343b9 Bug 1561738 - Use cbindgen for grid track sizing. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D36118
2019-06-28 12:44:43 +02:00
Cosmin Sabou
2fa2a56685 Backed out 3 changesets (bug 1561738) for causing build bustages on nsGridContainerFrame.cpp CLOSED TREE
Backed out changeset 98f100abc2ba (bug 1561738)
Backed out changeset 9ed20d0fb9ba (bug 1561738)
Backed out changeset 483b1e134ace (bug 1561738)
2019-06-28 13:27:09 +03:00
Emilio Cobos Álvarez
9d92ed9a07 Bug 1561738 - Use cbindgen for grid track sizing. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D36118

--HG--
extra : moz-landing-system : lando
2019-06-28 09:46:02 +00:00
Jan Henning
d507b88036 Bug 1552781 - Part 2: Flexboxes/grids should be font inflation flow roots. r=dbaron
Our algorithm for dividing a page up into separate font inflation flow roots
seems mostly based on the idea that a new Block Formatting Context (BFC) should
go hand in hand with a font inflation flow root.
Flex containers so far didn't follow that rule, since they technically create a
new *Flex* Formatting Context (FFC) and possibly also because nobody thought
about font inflation when implementing nsFlexContainerFrame.

This leads to all flex containers being counted against the next higher-level
flow root, meaning that a lot of small flex containers can get inflated if their
sum total of text *collectively* exceeds the font inflation threshold.
This alone is likely undesired most of the time, but is then also aggravated by
the fact that our flexbox behaviour under font inflation is somewhat buggy (bug
1142461).

As apart from the different layout rules inside the container, a FFC behaves
very much like a BFC in that it establishes a new formatting context, flex
containers should therefore correspondingly become font inflation flow roots,
too, and therefore be considered individually for font inflation.

As far as I can tell, with this change we'll also match Blink's behaviour in
that regard.

For completeness's sake, we'll make grid containers follow the same principles,
even though hopefully grids on non mobile-friendly pages should hopefully be
somewhat rarer than flexboxes.

Differential Revision: https://phabricator.services.mozilla.com/D32622

--HG--
extra : moz-landing-system : lando
2019-06-26 21:11:20 +00:00
Emilio Cobos Álvarez
e86340308c Bug 1559814 - Use the cbindgen representation for grid line properties. r=mats
We clamp earlier (parse time rather than computed value time), but that's the
only behavior change, which I think doesn't really matter.

Differential Revision: https://phabricator.services.mozilla.com/D35198

--HG--
extra : moz-landing-system : lando
2019-06-26 21:21:38 +00:00
Mihai Alexandru Michis
0f86a6b30b Backed out 4 changesets (bug 1559814) for causing bustages. CLOSED TREE
Backed out changeset 11ec9de59076 (bug 1559814)
Backed out changeset fec03c5d3661 (bug 1559814)
Backed out changeset 62f9d89fb827 (bug 1559814)
Backed out changeset 362d9435ca4e (bug 1559814)
2019-06-27 00:04:50 +03:00
Emilio Cobos Álvarez
f792986565 Bug 1559814 - Use the cbindgen representation for grid line properties. r=mats
We clamp earlier (parse time rather than computed value time), but that's the
only behavior change, which I think doesn't really matter.

Differential Revision: https://phabricator.services.mozilla.com/D35198

--HG--
extra : moz-landing-system : lando
2019-06-26 20:33:23 +00:00
Mats Palmgren
5e16c9c24a Bug 1558705 - [css-grid-2] Account for the subgrid's margin/border/padding when resolving its non-subgridded track sizes. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D35192

--HG--
extra : rebase_source : 7120e685adf61ca1f9eeddce0649d2747973f9c3
2019-06-17 15:03:03 +02:00
Emilio Cobos Álvarez
b7cf474626 Bug 1559546 - Introduce nsAtom::IsEmpty. r=njn
Both for symmetry with other string APIs, and also to prevent footguns (since I
debugged for a while a typo where I wrote nsGkAtoms::empty rather than
nsGkAtoms::_empty).

We could use null here, but that will not be possible in the future when I use
the rust representation of more grid data structures (at least without
increasing memory usage).

So I think I'll keep using ::_empty as a signaling value for "no grid
identifier".

Differential Revision: https://phabricator.services.mozilla.com/D35120

--HG--
extra : moz-landing-system : lando
2019-06-19 05:58:15 +00:00
Emilio Cobos Álvarez
6ed8680108 Bug 1559546 - Use atoms for grid line names. r=mats
The style system already atomizes all CustomIdent values, which means that we're
just wasting memory and CPU by doing string copies all over the place.

This patch fixes it. This also simplifies further changes to use as much of the
rust data structures as possible.

I had to switch from nsTHashtable to mozilla::HashTable because the former
doesn't handle well non-default-constructible structs (like NamedLine, which
now has a StyleAtom, which is not default-constructible).

Differential Revision: https://phabricator.services.mozilla.com/D35119

--HG--
extra : moz-landing-system : lando
2019-06-19 05:58:11 +00:00
Emilio Cobos Álvarez
841d3eea32 Bug 1559545 - Use servo for the representation of grid template areas. r=mats
Right now we do a lot of useless string copying. In order to avoid transcoding
to utf-16 during layout, make sure to use nsCString at a few related places.

I may revisit this since we're storing other line names as atoms in some places.
So it may be better to just use atoms everywhere.

But that'd be a different patch either way.

Depends on D35116

Differential Revision: https://phabricator.services.mozilla.com/D35117

--HG--
extra : moz-landing-system : lando
2019-06-18 22:29:58 +00:00
Ting-Yu Lin
3a4933eb98 Bug 1549267 Part 1 - Remove NS_INTRINSICSIZE and NS_AUTOHEIGHT. r=mats
This patch is generated by the following steps.

1) Manually delete NS_INTRINSICSIZE and NS_AUTOHEIGHT in LayoutConstants.

2) Run the following script.
```
  #!/bin/bash
  function rename() {
      find .\
           -type f\
           ! -path "./obj*"\
           ! -path "./.git"\
           ! -path "./.hg"\
           \( -name "*.cpp" -or\
              -name "*.h" \)\
              -exec sed -i -e "s/$1/$2/g" "{}" \;
  }

  rename NS_INTRINSICSIZE NS_UNCONSTRAINEDSIZE
  rename NS_AUTOHEIGHT NS_UNCONSTRAINEDSIZE
```

3) ./mach clang-format

Differential Revision: https://phabricator.services.mozilla.com/D31696

--HG--
extra : moz-landing-system : lando
2019-06-04 23:41:20 +00:00
Cosmin Sabou
c1685882cc Merge mozilla-central to mozilla-inbound. 2019-05-24 12:56:42 +03:00
Daniel Holbert
0f84d86e05 Bug 1552287 part 2: [css-contain] Adjust various reflow & baseline methods so that layout-contained frames behave as if they have no baseline. r=TYLin
We previously (in bug 1491235) adjusted some utility code to make
layout-contained frames behave as if they have no baseline.

But that's not sufficient. To make frames fully report lack-of-a-baseline,
we now do the following for layout-contained frames, as of this patch:

 (a) We now leave the ReflowOutput outparam's BlockStartAscent member at its
     default value (which is what we do for frames without a baseline like
     e.g. nsCheckboxRadioFrame and nsHTMLCanvasFrame). And if the parent cares
     about the baseline, it'll then ask directly, using a baseline getter.

 (b) We now return 'false' in more implementations of bool-returning
     baseline-getter-methods (where 'false' indicates 'no baseline').

 (c) We now return the margin-box-bottom edge, in the nscoord-returning
     'GetLogicalBaseline()' getter method. (We typically do this by deferring
     to the inherited method, which ultimately comes from nsFrame's
     implementation). It's appropriate to use the margin-box-bottom edge when
     there's no baseline, per the definition of 'vertical-align: baseline',
     here: https://drafts.csswg.org/css2/visudet.html#propdef-vertical-align

Depends on D32182

Differential Revision: https://phabricator.services.mozilla.com/D32183

--HG--
extra : moz-landing-system : lando
2019-05-24 04:46:17 +00:00
Andreea Pavel
9ea3c5f4bf Backed out 2 changesets (bug 1552287) for failing contain-layout-suppress-baseline-002.html on a CLOSED TREE
Backed out changeset 815c6657d164 (bug 1552287)
Backed out changeset 888c32d2a32e (bug 1552287)
2019-05-24 03:34:03 +03:00
Daniel Holbert
b15f05575d Bug 1552287 part 2: [css-contain] Adjust various reflow & baseline methods so that layout-contained frames behave as if they have no baseline. r=TYLin
We previously (in bug 1491235) adjusted some utility code to make
layout-contained frames behave as if they have no baseline.

But that's not sufficient. To make frames fully report lack-of-a-baseline,
we now do the following for layout-contained frames, as of this patch:

 (a) We now leave the ReflowOutput outparam's BlockStartAscent member at its
     default value (which is what we do for frames without a baseline like
     e.g. nsCheckboxRadioFrame and nsHTMLCanvasFrame). And if the parent cares
     about the baseline, it'll then ask directly, using a baseline getter.

 (b) We now return 'false' in more implementations of bool-returning
     baseline-getter-methods (where 'false' indicates 'no baseline').

 (c) We now return the margin-box-bottom edge, in the nscoord-returning
     'GetLogicalBaseline()' getter method. (We typically do this by deferring
     to the inherited method, which ultimately comes from nsFrame's
     implementation). It's appropriate to use the margin-box-bottom edge when
     there's no baseline, per the definition of 'vertical-align: baseline',
     here: https://drafts.csswg.org/css2/visudet.html#propdef-vertical-align

Depends on D32182

Differential Revision: https://phabricator.services.mozilla.com/D32183

--HG--
extra : moz-landing-system : lando
2019-05-23 21:41:35 +00:00
Mats Palmgren
e38772d545 Bug 1553824 - [css-grid-2] Invalidate any stored used track sizes on subgrids too. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D32372

--HG--
extra : amend_source : a4f1ebc717a5b9205e89a5b3651e956d33958089
2019-05-23 21:11:48 +02:00
Mats Palmgren
29ee64cea5 Bug 1547560 - [css-grid-2] Add subgrid gaps to its items contributions in track sizing and recompute the subgrid tracks size/position to center the subgrid gaps. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D31630

--HG--
extra : rebase_source : 5357831ac1395ae8f8f9252bb5a75b4c08eab25d
2019-05-17 16:50:42 +02:00
Mats Palmgren
a697823fed Bug 1471758 - [css-grid-2][css-contain] Make 'contain:paint' and 'contain:layout' inhibit a grid container from being a subgrid. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D29793

--HG--
extra : rebase_source : 8a709b9a0c58fe0ff1f21e1da07905470810bedd
2019-05-03 05:35:18 +02:00
Mats Palmgren
7457010aa7 Bug 1466358 part 11 - [css-grid-2] Update the frame's subgrid state when the style changes. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D29578

--HG--
extra : rebase_source : 49ffcf3927761705680522750306fabfaa126cb9
2019-05-01 23:53:47 +02:00
Mats Palmgren
19cf10b503 Bug 1466358 part 10 - [css-grid-2] Intrinsic sizing tweaks for subgrid. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D29242

--HG--
extra : rebase_source : 1b4209cc82f415607225d37b66351d8f9b26257e
2018-11-29 18:05:54 +01:00
Mats Palmgren
1a90f87c73 Bug 1466358 part 9 - [css-grid-2] Percentage basis calculation for subgrid items. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D29241

--HG--
extra : rebase_source : 6c59d4cfd2ac7951d94289a5e31ab47194b138a2
2018-11-29 18:05:54 +01:00
Mats Palmgren
7a16a53445 Bug 1466358 part 8 - [css-grid-2] Implement subgrid track sizing. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D29767

--HG--
extra : rebase_source : daacd5e49d25ff6791233aa2bf448141c0f565e0
2018-11-29 18:05:53 +01:00
Mats Palmgren
cb74a2be21 Bug 1466358 part 7 - [css-grid-2] Report the right number of tracks for subgrids in ComputedGridTrackInfo. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D29150

--HG--
extra : rebase_source : 31dfde3b701c636c884e686ecf6ebc336c9eb6af
2018-11-29 18:05:54 +01:00
Mats Palmgren
db19782fb2 Bug 1466358 part 6 - [css-grid-2] Always normalize child lists before a child list iterator is used. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D29149

--HG--
extra : rebase_source : 33c08ebd2ff810429bee2a7a1e3a3eb624b1c92d
2018-11-29 18:05:54 +01:00
Mats Palmgren
89a0e0ff36 Bug 1466358 part 5 - [css-grid-2] Add the accumulated margin+border+padding of subgrid ancestors to a subgrid item's content contribution if it spans the relevant edge track(s). r=dholbert
--HG--
extra : rebase_source : c5df2b3d291b7ed361f5a4ee3c3bd0089419022a
2018-11-29 18:05:53 +01:00
Mats Palmgren
06a57d5591 Bug 1466358 part 4 - [css-grid-2] Make a subgrid contribute its accumulated margin+border+padding to its edge tracks for intrinsically sized tracks. r=dholbert
--HG--
extra : rebase_source : 83b74a75ff146fbaca8f9db6e8a66e09b50967b8
2018-11-29 18:05:53 +01:00
Mats Palmgren
dfe59e9674 Bug 1466358 part 3 - [css-grid-2] Add methods to calculate a subgrid's margin+border+padding. r=dholbert
--HG--
extra : rebase_source : d4b436d37d85922f1469b7a264e1438ca1d0d270
2018-11-29 18:05:40 +01:00
Mats Palmgren
72368fabf1 Bug 1466358 part 2 - [css-grid-2] Add a method to recursively collect relevant items for track sizing from subgrids with their lines and state translated into the caller's coordinates (idempotent patch). r=dholbert
--HG--
extra : rebase_source : abdc194a8ae862327c95170582d37b6fe039584d
2018-11-29 00:18:10 +01:00
Mats Palmgren
88e099b7c3 Bug 1466358 part 1 - [css-grid-2] Add grid item state bits for subgrids and items in a subgrid and set them when the item occupies the corresponding edge track (idempotent patch). r=dholbert
--HG--
extra : rebase_source : 0f5ac0554b5c72691eee760562a5189f549ce1cd
2018-11-29 00:18:10 +01:00
Mats Palmgren
8b3af96735 Bug 1465296 part 5 - [css-grid-2] Implement nested area name lookups for subgrids. r=dholbert
--HG--
extra : rebase_source : cd705c3332ab995348be12a06ff26f3099df26eb
2018-11-29 00:18:09 +01:00
Mats Palmgren
01f4698389 Bug 1465296 part 4 - [css-grid-2] Implement nested line name lookups for subgrids. r=dholbert
This adds a pointer to the parent grid's LineNameMap in
the relevant axis and traverses that recursively when
looking up line names.

--HG--
extra : rebase_source : fb088178209238f7a9e7d6dd2458940779d011fe
2018-11-29 00:18:09 +01:00
Mats Palmgren
94606c0340 Bug 1465296 part 3 - [css-grid-2] Add a convenience method to get the parent GridContainerFrame for a subgrid. r=dholbert
--HG--
extra : rebase_source : fc657580b7a0f3aff9b925942995cb0956f71233
2018-11-29 00:18:09 +01:00
Mats Palmgren
4732ab3c6e Bug 1465296 part 2 - [css-grid-2] Clamp lines in a subgrid to its extent. r=dholbert
Per https://drafts.csswg.org/css-grid-2/#subgrid-implicit

--HG--
extra : rebase_source : feda495fc1e9d17fcdb2283eb3bbec198eec3b1b
2018-11-29 00:18:09 +01:00
Mats Palmgren
3d75f50167 Bug 1465296 part 1 - [css-grid-2] Implement subgrid item placement. r=dholbert
--HG--
extra : rebase_source : d69ac36a02178a7ecb340a28caac3f2c8b7bfc39
2018-11-29 00:18:09 +01:00
Ting-Yu Lin
63457d2b61 Bug 1548673 Part 1 - Rename NS_INTRINSIC_WIDTH_UNKNOWN to NS_INTRINSIC_ISIZE_UNKNOWN. r=jfkthame
This patch is generated by running the following script under layout/,
and then manually delete the FIXME comment in LayoutConstants.h

  #!/bin/bash
  function rename() {
      find .\
           -type f\
           ! -path "./obj*"\
           ! -path "./.git"\
           ! -path "./.hg"\
           \( -name "*.cpp" -or\
              -name "*.h" \)\
              -exec sed -i -e "s/$1/$2/g" "{}" \;
  }
  rename NS_INTRINSIC_WIDTH_UNKNOWN NS_INTRINSIC_ISIZE_UNKNOWN

Differential Revision: https://phabricator.services.mozilla.com/D29746

--HG--
extra : moz-landing-system : lando
2019-05-03 17:34:36 +00:00
Emilio Cobos Álvarez
11ea945833 Bug 1546697 - Use a consistent style for enum classes in layout. r=dholbert
Per the discussion in:

  https://groups.google.com/d/msg/mozilla.dev.platform/P79pwa9z5m8/iPYPAWPHCAAJ

They should be CamelCase, and that's what most of them already do. This converts
the rest, which are a few.

For the ones that already used `e` or `k` prefixes, I've mostly done:

 for file in $(rg Type::e layout | cut -d : -f 1 | sort | uniq); do sed -i 's#Type::e#Type::#g' $file; done

For the ones that used uppercase, I've removed the prefix if it was already in
the type name, and turn them into CamelCase.

Depends on D28680

Differential Revision: https://phabricator.services.mozilla.com/D28681

--HG--
extra : moz-landing-system : lando
2019-04-25 23:03:04 +00:00
Emilio Cobos Álvarez
6159d9a874 Bug 1546697 - Make BaselineSharingGroup an enum class. r=dholbert
It looked a bit weird when mixed up with the other enum classes I'm about to
rename.

Depends on D28679

Differential Revision: https://phabricator.services.mozilla.com/D28680

--HG--
extra : moz-landing-system : lando
2019-04-25 22:42:13 +00:00
Masayuki Nakano
3622509485 Bug 1545342 - part 2: Make some public enum of nsIPresShell move to mozilla namespace and defined as enum class in PresShellForwards.h r=smaug
This patch moves some `enum` in `nsIPresShell` which are in public scope into
`mozilla` namespace and change them as `enum class`es.

Unfortunately, only "where to scroll" enum is just defines constants of
percentages of scroll destination.  Therefore, this patch makes only them
as `static const`.

Differential Revision: https://phabricator.services.mozilla.com/D28606

--HG--
extra : moz-landing-system : lando
2019-04-25 05:04:15 +00:00
Ting-Yu Lin
49cfcc232c Bug 1546223 Part 4 - Mechanically replace pointer with Maybe for ReflowInput's optional containing block size. r=dholbert
There's no behavior change in this patch.

Differential Revision: https://phabricator.services.mozilla.com/D28426

--HG--
extra : moz-landing-system : lando
2019-04-24 17:35:31 +00:00
Masayuki Nakano
2f9688c14e Bug 1544343 - part 2: Make factory methods take mozilla::PresShell instead of nsIPresShell r=emilio
Additionally, this patch makes `nsFrame.h` stop including `nsIPresShell.h`
and makes each users include `mozilla/PresShell.h` instead.  So, this improves
rebuild performance of `nsIPresShell.h` (and `mozilla/PresShell.h` in the
future).

Note that due to `nsIFrame::PresShell()`, `mozilla::` prefix is necessary for
`PresShell` in a lot of classes which are derived from `nsIFrame` even in
`.cpp` files.

Differential Revision: https://phabricator.services.mozilla.com/D27476

--HG--
extra : moz-landing-system : lando
2019-04-16 07:24:49 +00:00
Masayuki Nakano
414509fe00 Bug 1543315 - part 9: Mark nsIPresShell::FlushPendingNotifications() as MOZ_CAN_RUN_SCRIPT r=smaug
So, this patch makes all caller of it safe including its arguments unless
they come from other methods.

Differential Revision: https://phabricator.services.mozilla.com/D27225

--HG--
extra : moz-landing-system : lando
2019-04-13 12:43:57 +00:00
Ting-Yu Lin
04a76d27a6 Bug 1543571 Part 2 - Replace DUMMY_PARENT_REFLOW_STATE with DUMMY_PARENT_REFLOW_INPUT. r=dholbert
This patch is generated by the following script running on Linux:

function rename() {
    find .\
         -type f\
         ! -path "./obj*"\
         ! -path "./.git"\
         ! -path "./.hg"\
         \( -name "*.cpp" -or\
            -name "*.h" \)\
            -exec sed -i -e "s/$1/$2/g" "{}" \;
}
rename DUMMY_PARENT_REFLOW_STATE DUMMY_PARENT_REFLOW_INPUT

Differential Revision: https://phabricator.services.mozilla.com/D27023

--HG--
extra : moz-landing-system : lando
2019-04-11 20:27:18 +00:00
Ting-Yu Lin
f49d08722a Bug 1543571 Part 1 - Replace "reflow state" with "reflow input". r=dholbert
This patch is generated by the following script on Linux:

function rename() {
    find .\
         -type f\
         ! -path "./obj*"\
         ! -path "./.git"\
         ! -path "./.hg"\
         \( -name "*.cpp" -or\
            -name "*.h" \)\
            -exec sed -i -e "s/$1/$2/g" "{}" \;
}
rename "reflow state" "reflow input"

Differential Revision: https://phabricator.services.mozilla.com/D27022

--HG--
extra : moz-landing-system : lando
2019-04-11 20:27:37 +00:00
Emilio Cobos Álvarez
bb47a90d4f Bug 1543401 - Use rust lengths for row-gap / column-gap. r=mats
Differential Revision: https://phabricator.services.mozilla.com/D26915

--HG--
extra : moz-landing-system : lando
2019-04-10 16:00:03 +00:00
Masayuki Nakano
e8446480e1 Bug 1542407 - Make nsIFrame use mozilla::PresShell directly rather than via nsIPresShell r=emilio
Except retrieving from weak reference, `nsIFrame` should treat
`mozilla::PresShell` directly rather than via `nsIPresShell`.

Differential Revision: https://phabricator.services.mozilla.com/D26388

--HG--
extra : moz-landing-system : lando
2019-04-06 06:02:28 +00:00
Masayuki Nakano
9165a150a1 Bug 1540930 - Make nsPresContext use mozilla::PresShell directly rather than via nsIPresShell r=emilio
`nsPresContext` should use `mozilla::PresShell` directly instead of
`nsIPresShell`.  This patch makes it.

Unfortunately, `nsPresContext` and `nsIFrame` have `PresShell()`.  Therefore,
we cannot use `PresShell*` in its methods so that this patch uses `mozilla::`
namespace prefix.

It might be better to rename them as `PresShellPtr()` in another bug.

Differential Revision: https://phabricator.services.mozilla.com/D25721

--HG--
extra : moz-landing-system : lando
2019-04-03 12:40:26 +00:00
Mats Palmgren
bff6f8a4d5 Bug 288704 part 3 - Make nsBulletFrame use the built-in 'list-item' CSS counter and remove the old implementation. r=emilio 2019-03-24 23:13:53 +01:00
Mats Palmgren
0f4868138a Bug 1526567 - [css-grid] Make the block-axis percentage basis be indefinite for measuring reflows. r=dholbert 2019-02-22 13:58:24 +01:00
Emilio Cobos Álvarez
c4ae51b99d Bug 1529058 - Use Rust types for perspective and z-index. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D20381

--HG--
extra : moz-landing-system : lando
2019-02-19 23:04:45 +00:00
Emilio Cobos Álvarez
e9ae3b0907 Bug 1527410 - Use Rust sizes for flex-basis, width, height, and their min/max properties. r=jwatt
Really sorry for the size of the patch :(

Only intentional behavior change is in the uses of HasLengthAndPercentage(),
where it's easier to do the right thing. The checks that used to check for
(IsCalcUnit() && CalcHasPercentage()) are wrong since bug 957915.

Differential Revision: https://phabricator.services.mozilla.com/D19553
2019-02-15 03:59:31 +01:00
Emilio Cobos Álvarez
12867b1a3f Bug 1525371 - Kill ComputedStyle::mPresContext, move the pointer to the frame instead. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D18734
2019-02-07 11:15:36 +01:00
Ehsan Akhgari
e5e885ae31 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset

--HG--
extra : amend_source : 7221c8d15a765df71171099468e7c7faa648f37c
extra : histedit_source : a0cce6015636202bff09e35a13f72e03257a7695
2019-01-18 10:16:18 +01:00
Ting-Yu Lin
6cf6eb81f5 Bug 1515192 - Replace handcrafted FrameChildListIDs class with EnumSet. r=mats
The following APIs are changed.
1. Contains() needs to become contains(). (EnumSet's methods have lowercase names.)
2. Use list constructor rather than "|" like a plain enum.
3. Use operator+= instead of operator|=.

Differential Revision: https://phabricator.services.mozilla.com/D14908

--HG--
extra : moz-landing-system : lando
2018-12-19 00:50:09 +00:00