Граф коммитов

399 Коммитов

Автор SHA1 Сообщение Дата
Emilio Cobos Álvarez a4e7c9e510 Bug 1722945 - Support break-inside: avoid-{page,column}. r=TYLin
break-before/after: page|column seem harder because you need to deal
with nested breaks, I think, but this should be straight-forward.

Differential Revision: https://phabricator.services.mozilla.com/D121206
2021-08-03 17:56:58 +00:00
Noemi Erli 89a565ea85 Backed out changeset 67c33ba5566e (bug 1722945) for causing bustage in nsContainerFrame.cpp 2021-08-03 20:35:10 +03:00
Emilio Cobos Álvarez 3d1b4f252f Bug 1722945 - Support break-inside: avoid-{page,column}. r=TYLin
break-before/after: page|column seem harder because you need to deal
with nested breaks, I think, but this should be straight-forward.

Differential Revision: https://phabricator.services.mozilla.com/D121206
2021-08-03 13:59:47 +00:00
Ting-Yu Lin 97b5489509 Bug 1716212 Part 1 - Rename CalcLineHeight to GetLineHeight, and cache used line height in ReflowInput. r=emilio
This patch introduces `mLineHeight`, and it opens the possibility to
override it in Part 2.

Differential Revision: https://phabricator.services.mozilla.com/D120876
2021-07-28 18:41:18 +00:00
Ting-Yu Lin 545a6376cd Bug 1677635 Part 4 - Rename nsOverflowAreas to OverflowAreas, and move it into mozilla namespace. r=layout-reviewers,emilio
This patch is generated via the rename functionality in my editor; add
`mozilla::` prefix to `OverflowAreas` in headers; and remove the
`OverflowType` alias added in Part 1.

Differential Revision: https://phabricator.services.mozilla.com/D97235
2020-11-18 00:08:12 +00:00
Ting-Yu Lin 1c052b9ff3 Bug 1674931 Part 2 - Add WritingMode argument to SizeComputationInput::ComputedLogicalBorderPadding(), and adapt callers. r=jfkthame
This patch is similar to Part 1, but for ComputedLogicalBorderPadding().

Differential Revision: https://phabricator.services.mozilla.com/D95662
2020-11-03 19:57:40 +00:00
Ting-Yu Lin 9910d9e651 Bug 1674931 Part 1 - Add WritingMode argument to SizeComputationInput::ComputedLogicalMargin(), and adapt callers. r=jfkthame
It's straightforward to determine which writing mode is required to pass
to ComputedLogicalMargin() by looking at any subsequent method called on
the margin.

For example, if we see

```
ComputedLogicalMargin().BStartEnd(wm);
```

the writing mode needed to pass to `ComputedLogicalMargin()` is `wm`.

Differential Revision: https://phabricator.services.mozilla.com/D95661
2020-11-03 19:44:58 +00:00
Ting-Yu Lin 709e05b496 Bug 1671319 - Remove GetAvailableContentISize in nsColumnSetFrame.cpp. r=emilio
nsColumnSetFrame won't have any border and padding because it's an inner
frame under ColumnSetWrapper. We've already asserted this fact at the
beginning of nsColumnSetFrame::Reflow().

This change shouldn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D93626
2020-10-15 17:30:28 +00:00
Ting-Yu Lin 0076add365 Bug 1641085 Part 1 - Add move semantic to nsFrameList, and use it on SetOverflowFrames(). r=mats
It's useful to use `std::move()` to indicate the frames' ownership in one list
is transferred to the another list.

For a frame list managed by AutoFrameListPtr, after moving its frames to
another list, it can be automatically deleted when it is going out of
scope.

Differential Revision: https://phabricator.services.mozilla.com/D88455
2020-08-29 00:22:16 +00:00
Ting-Yu Lin e7a3e6870c Bug 1661874 Part 4 - Simplify the condition to set colData.mHasExcessBSize to true. r=heycam
nsColumnSetFrame's ComputedBSize() and ComputedMaxBSize() are always
NS_UNCONSTRAINEDSIZE.

Differential Revision: https://phabricator.services.mozilla.com/D88700
2020-08-31 03:45:38 +00:00
Ting-Yu Lin 7ffc02eb41 Bug 1661874 Part 3 - Reverse the meaning of skipIncremental and rename it. r=heycam
I feel skipIncremental is hard to reasoning. It's easier to list all the
possible reasons that the child needs to be reflowed again.

Differential Revision: https://phabricator.services.mozilla.com/D88699
2020-08-31 03:45:23 +00:00
Ting-Yu Lin be1519920a Bug 1661874 Part 2 - Remove the support of ColumnSetFrame being an abs.pos container. r=heycam
The support of this was added in
https://hg.mozilla.org/mozilla-central/rev/fb0790d28846

After supporting column-span, ColumnSetFrame isn't the top-level
multicol container anymore, and is not served as an abs.pos container.
Thus, we can simply the reflow code a bit.

Differential Revision: https://phabricator.services.mozilla.com/D88698
2020-08-31 03:45:15 +00:00
Ting-Yu Lin 218e47c67f Bug 1661874 Part 1 - Rename mColMaxBSize to mColBSize in ReflowConfig. r=heycam
Rename so that its naming is consistent with ReflowConfig::mColISize,
and to avoid confusion with ColumnBalanceData::mMaxBSize.

Differential Revision: https://phabricator.services.mozilla.com/D88697
2020-08-31 03:45:13 +00:00
Ting-Yu Lin a9328a86bf Bug 1658198 - Provide a minimum starting value for extraBlockSize in FindBestBalanceBSize. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D87131
2020-08-16 00:46:30 +00:00
Ting-Yu Lin bffd4f08c6 Bug 1647520 Part 4 - Stop binary search once the feasible and infeasible block-size is within one device pixel. r=heycam
The gist of this patch is: once the feasible and infeasible block-size
is within one device pixel, we choose nextGuess to be the greatest
multiple of one device pixel below or equal to the feasible block-size.
If this nextGuess is infeasible, we will reflow children one last time
by using the last feasible block-size and done with the balancing.

Differential Revision: https://phabricator.services.mozilla.com/D83732
2020-07-20 22:28:45 +00:00
Ting-Yu Lin e68bedf3c5 Bug 1647520 Part 3 - Improve some comments in FindBestBalanceBSize(). r=heycam
Here's an example that can break the loop at the first iteration.
<div style="column-count:2; height:100px"><img src="" style="height:500px">

Differential Revision: https://phabricator.services.mozilla.com/D83731
2020-07-20 22:27:44 +00:00
Ting-Yu Lin fdc00547f6 Bug 1637130 - Rename visual overflow to ink overflow. r=dbaron
This patch is generated by:

```
# Rename the nsOverflowType enum.
rg -l "eVisualOverflow" layout/ gfx/ | xargs sed -i "s/eVisualOverflow/eInkOverflow/g"

# Rename and drop the "Get" prefix from various functions.
rg -l "GetVisualOverflowRect" layout/ gfx/ | xargs sed -i "s/GetVisualOverflowRect/InkOverflowRect/g"
rg -l "GetPreEffectsVisualOverflowRect" layout/ gfx/ | xargs sed -i "s/GetPreEffectsVisualOverflowRect/PreEffectsInkOverflowRect/g"
rg -l "GetVisualOverflowFromDeltas" layout/ gfx/ | xargs sed -i "s/GetVisualOverflowFromDeltas/InkOverflowFromDeltas/g"
rg -l "GetScrollableOverflowRect" layout/ gfx/ | xargs sed -i "s/GetScrollableOverflowRect/ScrollableOverflowRect/g"

# Rename, drop the "Get" prefix, and change the suffix "Area" to "Rect"
# (because they return nsRect) for the two methods in nsLineBox.
rg -l "GetVisualOverflowArea" layout/ gfx/ | xargs sed -i "s/GetVisualOverflowArea/InkOverflowRect/g"
rg -l "GetScrollableOverflowArea" layout/ gfx/ | xargs sed -i "s/GetScrollableOverflowArea/ScrollableOverflowRect/g"

# Rename rest of the functions and variables.
rg -l "VisualOverflow" layout/ gfx/ | xargs sed -i "s/VisualOverflow/InkOverflow/g"
rg -l "visual overflow" layout/ gfx/ | xargs sed -i "s/visual overflow/ink overflow/g"
rg -l "visualOverflow" layout/ gfx/ | xargs sed -i "s/visualOverflow/inkOverflow/g"
rg -l "visOverflow" layout/ gfx/ | xargs sed -i "s/visOverflow/inkOverflow/g"
rg -l "vis-overflow" layout/ gfx/ python/ | xargs sed -i "s/vis-overflow/ink-overflow/g"

./mach clang-format
```

Differential Revision: https://phabricator.services.mozilla.com/D84231
2020-07-20 20:17:36 +00:00
Ting-Yu Lin ffcfb6dcec Bug 1651171 - Convert NS_SUBTREE_DIRTY to an inline method of nsIFrame. r=jfkthame
This is a straightforward conversion except that
`NS_SUBTREE_DIRTY(this)` can be written terser as `IsSubtreeDirty()`.

Differential Revision: https://phabricator.services.mozilla.com/D82811
2020-07-09 18:29:15 +00:00
Kagami Sascha Rosylight 2bd2a63ded Bug 1647525 - Use HasAnyStateBits() in nsColumnSetFrame r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D81198
2020-06-27 13:16:31 +00:00
Ting-Yu Lin 6047332ae6 Bug 1647332 Part 4 - Keep doubling the extra block-size that adds to the estimate column block-size until finding a feasible one. r=heycam
In FindBestBalanceBSize(), suppose we have aUnboundedLastColumn equals
to true, and the measuring reflow of all the columns is feasible. This
setting represents the most common scenario of multi-column layout as
the multi-column footnote on Wikipedia.

We used to use 600 as the extra block-size added to the estimate column
block-size. However, if the first guess of the column block-size, say
G1, is infeasible, the feasible block-size is still bound to the sum of
all columns S. That leaves us a massive range between G1 and S to
search.

We don't want to use a larger fixed extra block-size. Although it can
reduce the possibility of failing the first guess, but for cases where a
smaller extra block-size is sufficient, it increases the search range
and the iteration number before the binary search converges.

Instead, we can spend the first few iterations doubling the extra
block-size E added to the estimate column block-size until we find the
first feasible block-size. This gives us a smaller upper bound S / N +
E, where N is the number of columns.

Differential Revision: https://phabricator.services.mozilla.com/D80571
2020-06-23 18:34:42 +00:00
Ting-Yu Lin 7818447d6c Bug 1647332 Part 3 - Extract the constant 600 app units when estimating balancing column block-size. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D80570
2020-06-23 18:34:40 +00:00
Ting-Yu Lin 777470ec78 Bug 1647332 Part 2 - Output the number of columns in ColumnBalanceData, and replace nsFrameList::GetLength(). r=heycam
The motivation is to replace mFrames.GetLength() in
FindBestBalanceBSize() since it is O(N), where N is the number of
columns.

Also, counting the column number from 1 so that it matches mUsedColCount
without needing to subtract 1 at some places.

Differential Revision: https://phabricator.services.mozilla.com/D80569
2020-06-23 18:34:36 +00:00
Ting-Yu Lin 24871a70de Bug 1647332 Part 1 - Print more information in column set log. r=heycam
* childContentBEnd: this value can be larger than
kidDesiredSize.BSize(wm) if -moz-column-content anonymous blocks has a
child which is overflow-incomplete.

* mLastBSize: last column's block-size is important in column balancing
algorithm because it sets mKnownInfeasibleBSize when a balancing
iteration is feasible.

* The iteration count in column balancing. This is an easy way to
observe column balancing performance.

Differential Revision: https://phabricator.services.mozilla.com/D80568
2020-06-23 18:34:34 +00:00
Ting-Yu Lin 9ebd7d8fc0 Bug 1634102 - Always balance columns before column-spans (regardless the column-fill property). r=dbaron
Differential Revision: https://phabricator.services.mozilla.com/D77570
2020-06-17 03:35:42 +00:00
Ting-Yu Lin aa8db6ce2d Bug 1614101 - Make sure ColumnSet does not split in the last reflow if ColumnSetWrapper's available block-size is unconstrained. r=dbaron
Checking ColumnSet's available block-size [1] makes no sense nowadays
because ColumnSet is an inner frame under ColumnSetWrapper. We should
check ColumnSetWrapper's available block-size instead.

Also, bump assertions count for 1015844.html on Android, which is a
crashtest having multicols.

[1] The comment was also misleading, which said it was checking
ColumnSet's "block-size", but it actually was checking available
block-size.

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

--HG--
extra : moz-landing-system : lando
2020-03-04 18:21:01 +00:00
Csoregi Natalia f57c04f7ff Backed out changeset 5ecd70faa23f (bug 1614101) for crashtest failures on 1015844.html. CLOSED TREE 2020-03-04 19:41:38 +02:00
Ting-Yu Lin bf48011278 Bug 1614101 - Make sure ColumnSet does not split in the last reflow if ColumnSetWrapper's available block-size is unconstrained. r=dbaron
Checking ColumnSet's available block-size [1] makes no sense nowadays
because ColumnSet is an inner frame under ColumnSetWrapper. We should
check ColumnSetWrapper's available block-size instead.

[1] The comment was also misleading, which said it was checking
ColumnSet's "block-size", but it actually was checking available
block-size.

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

--HG--
extra : moz-landing-system : lando
2020-03-03 13:07:40 +00:00
Ting-Yu Lin 95282ce758 Bug 1618646 Part 2 - Remove mComputedBSize and mConsumedBSize in nsColumnSetFrame::ReflowConfig. r=mats
They were used when nsColumnSetFrame was still a column container, but
are not used today.

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

--HG--
extra : moz-landing-system : lando
2020-02-28 22:36:35 +00:00
Ting-Yu Lin 450809ad1c Bug 1618646 Part 1 - Remove nsColumnSetFrame::GetAvailableContentBSize(). r=mats
ColumnSet is an inner frame now. It cannot have border and padding.

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

--HG--
extra : moz-landing-system : lando
2020-02-28 22:35:21 +00:00
Simon Giesecke 9350e6b741 Bug 1613985 - Use MOZ_COUNTED_DEFAULT_CTOR_*/MOZ_COUNTED_DTOR_* macros. r=froydnj
This removes the need for explicit #ifdef NS_BUILD_REFCNT_LOGGING without
introducing user-defined destructors when it is not defined.

Also, some uses of virtual for declaring destructors are replaced by the
appropriate override declaration through these changes.

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

--HG--
extra : moz-landing-system : lando
2020-02-20 11:40:14 +00:00
Dorel Luca d5f9df8ee1 Backed out 2 changesets (bug 1613985) for Build bustage on Windows2012. CLOSED TREE
Backed out changeset fd177b40b561 (bug 1613985)
Backed out changeset fb6d62b7f28d (bug 1613985)
2020-02-19 22:22:41 +02:00
Simon Giesecke 59b23375c0 Bug 1613985 - Use MOZ_COUNTED_DEFAULT_CTOR_*/MOZ_COUNTED_DTOR_* macros. r=froydnj
This removes the need for explicit #ifdef NS_BUILD_REFCNT_LOGGING without
introducing user-defined destructors when it is not defined.

Also, some uses of virtual for declaring destructors are replaced by the
appropriate override declaration through these changes.

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

--HG--
extra : moz-landing-system : lando
2020-02-19 18:05:38 +00:00
Emilio Cobos Álvarez 006e5cca66 Bug 1614198 - Use cbindgen instead of nsStyleImage. r=aosmond
The trickier part is that we represent -moz-image-rect as a Rect() type instead
of image with non-null clip-rect. So we need to add a bit of code to
distinguish "image request types" from other types of images.

But it's not too annoying, and we need to do the same for fancier images like
image-set and such whenever we implement it, so seems nice to get rid of
most explicit usages of nsStyleImage::GetType().

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

--HG--
extra : moz-landing-system : lando
2020-02-11 20:56:20 +00:00
Ting-Yu Lin 4c6c2f7bbe Bug 1603088 Part 2 - Delete NS_FRAME_CONTAINS_RELATIVE_BSIZE manipulation in nsColumnSetFrame::Reflow(). r=dbaron
Nowadays, ColumnSetFrame is an inner frame under ColumnSetWrapperFrame.
It always has "block-size: auto", so `aReflowInput.ComputedBSize()`
always equals to NS_UNCONSTRAINEDSIZE.

Also, -moz-column-content no longer has "max-block-size: 100%", so
NS_FRAME_CONTAINS_RELATIVE_BSIZE can never be set on ColumnSetFrame when
constructing ReflowInputs for ColumnSetFrame's children in
`ReflowInput::InitResizeFlags`. Removing the bit is not needed, either.

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

--HG--
extra : moz-landing-system : lando
2020-01-08 02:48:14 +00:00
Bogdan Tara d0de37ac8e Backed out 2 changesets (bug 1603088) for android crashtest failures on 1015844.html
Backed out changeset 2bd2d03f3c45 (bug 1603088)
Backed out changeset d4cc66fb7593 (bug 1603088)
2020-01-08 02:04:06 +02:00
Ting-Yu Lin fa839d3679 Bug 1603088 Part 2 - Delete NS_FRAME_CONTAINS_RELATIVE_BSIZE manipulation in nsColumnSetFrame::Reflow(). r=dbaron
Nowadays, ColumnSetFrame is an inner frame under ColumnSetWrapperFrame.
It always has "block-size: auto", so `aReflowInput.ComputedBSize()`
always equals to NS_UNCONSTRAINEDSIZE.

Also, -moz-column-content no longer has "max-block-size: 100%", so
NS_FRAME_CONTAINS_RELATIVE_BSIZE can never be set on ColumnSetFrame when
constructing ReflowInputs for ColumnSetFrame's children in
`ReflowInput::InitResizeFlags`. Removing the bit is not needed, either.

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

--HG--
extra : moz-landing-system : lando
2020-01-07 20:19:27 +00:00
Ting-Yu Lin 48fe88d373 Bug 1499281 - Remove column-span pref in nsColumnSetFrame. r=dbaron
Differential Revision: https://phabricator.services.mozilla.com/D58396

--HG--
extra : moz-landing-system : lando
2019-12-31 16:10:21 +00:00
James Hooks 6ea13e1732 Bug 1585806 - Make SideBits an enum class, add casting where necessary. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D51291

--HG--
extra : moz-landing-system : lando
2019-11-16 20:59:34 +00:00
Ting-Yu Lin d0f336a7a6 Bug 1591546 Part 1 - Add WritingMode::IsBidiRTL(). r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D50771

--HG--
extra : moz-landing-system : lando
2019-10-28 09:33:05 +00:00
Daniel Holbert 547238dc03 Bug 1590639 part 1: Fix non-unified build issues in layout/generic. r=TYLin
The issues fall into these categories:
 - Files that used StaticPrefs::layout_XYZ() API or gfxVars::XYZ that needed an
   include. (Addressed by adding the missing include.)
 - Files that use mozilla::dom::XYZ or mozilla::gfx::XYZ without qualifying the
   namespace & without a 'using' decl. (Addressed by adding "using".)
 - A few other includes for types/inlines that were used without their header.

Depends on D50162

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

--HG--
extra : moz-landing-system : lando
2019-10-23 22:05:22 +00:00
Ting-Yu Lin df696cf9c1 Bug 1575054 - Disable column balancing for nested multicol containers of depth more than two. r=dbaron
That is, for the multicol container of depth two and more, we lay them
out by using "column-fill:auto" and "column-count:1".

I've check bug 725376 comment 9 for the previous approaches. Thanks to
bug 1555818, this solution is feasible because the fragmentation with
"column-fill:auto" is now possible.

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

--HG--
extra : moz-landing-system : lando
2019-09-26 22:07:53 +00:00
Coroiu Cristina b567839436 Backed out changeset e10a3c249943 (bug 1575054) for crashtest failures at reftest/tests/layout/generic/crashtests/812893.html on a CLOSED TREE 2019-09-27 00:16:47 +03:00
Ting-Yu Lin 1e019098f5 Bug 1575054 - Disable column balancing for nested multicol containers of depth more than two. r=dbaron
That is, for the multicol container of depth two and more, we lay them
out by using "column-fill:auto" and "column-count:1".

I've check bug 725376 comment 9 for the previous approaches. Thanks to
bug 1555818, this solution is feasible because the fragmentation with
"column-fill:auto" is now possible.

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

--HG--
extra : moz-landing-system : lando
2019-09-24 21:38:00 +00:00
Ting-Yu Lin 626ea340bc Bug 1583639 Part 4 - Stop creating more columns in column-fill:auto mode if there's still block-size left in multicol container. r=dbaron
This patch makes fragmentation in "column-fill:auto" mode possible.

Note that we only bail out of creating more column contents when
"column-fill:auto" mode is set from the styles, i.e. when mForceAuto is
false. That is because when mForceAuto is true, we usually in the case
where we have gave up balancing, and we really want to create overflow
columns.

Note: without `!aConfig.mForceAuto` check, 673770.html can generated
assertions, and the frame tree contains dangling Overflow-lines and
ExcessOverflowContainersList.

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

--HG--
extra : moz-landing-system : lando
2019-09-25 23:36:41 +00:00
Ting-Yu Lin 771bb28447 Bug 1583639 Part 3 - Keep the optimal used numColumns in column-fill:auto mode without resetting it to INT32_MAX. r=dbaron
mUsedColCount is used in balancing mode to check whether we have created
the maximum number of columns when the content cannot fit. Similarly,
mUsedColCount can also be useful in "column-fill:auto" mode to improve
the fragmentation story in the next patch.

This patch doesn't change the behavior (yet).

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

--HG--
extra : moz-landing-system : lando
2019-09-25 06:41:10 +00:00
Ting-Yu Lin fd1d19e6aa Bug 1583639 Part 2 - Rename mBalanceColCount to mUsedColCount in nsColumnSetFrame::ReflowConfig. r=dbaron
In next patch, this variable won't be set to INT32_MAX in
"column-fill:auto" mode, and it will be used in Part 4. Hence the
rename.

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

--HG--
extra : moz-landing-system : lando
2019-09-25 06:43:19 +00:00
Ting-Yu Lin eded32bd45 Bug 1583639 Part 1 - De-indent an else-block inside the while-loop in nsColumnSetFrame::ReflowChild. r=dbaron
The associated if-block has a "break" statement at the end of the scope
to break the while-loop, making the else-block redundant.

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

--HG--
extra : moz-landing-system : lando
2019-09-24 21:09:20 +00:00
Ting-Yu Lin 88413c82e6 Bug 1575016 - Update a comment that describes minimum 1px block-size for column-content blocks. r=dbaron
Fragmentation spec already has a paragraph describing this behavior.

DONTBUILD because this is a comment only change.

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

--HG--
extra : moz-landing-system : lando
2019-09-21 08:38:54 +00:00
Ting-Yu Lin 4c19765137 Bug 1575964 Part 2 - Fix RTL column positions when column-span is enabled. r=dbaron
Since column-contents' positions are moved, we need to fix ColumnSet's
overflow areas as well.

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

--HG--
extra : moz-landing-system : lando
2019-09-17 01:12:30 +00:00
Ting-Yu Lin a9b1812a76 Bug 1575964 Part 1 - Separate a fixup logic which is redundant if column-span is enabled. r=dbaron
Differential Revision: https://phabricator.services.mozilla.com/D44278

--HG--
extra : moz-landing-system : lando
2019-09-16 18:45:34 +00:00