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

34 Коммитов

Автор SHA1 Сообщение Дата
Daniel Holbert 18c31e716e Bug 1695509: Don't inflate overflow areas with stale positions of pushed floats that we drained but weren't able to place. r=TYLin
Before this patch, there's an edge case where we may drain a pushed float (with
a stale position), and then discover that it won't fit in the current block (so
we push it and leave its position untouched), but we still inadvertently
include its rect in the current block's overflow areas.  This means we're
feeding stale/bogus position into the overflow areas, which can make them
unnecessarily huge.

This patch accounts for this by only considering overflow from floats that we
actually successfully placed, in ReflowPushedFloats.

(Also: this patch removes a stale bit of documentation about aLineLayout being
possibly-null in AddFloat.  In actuality, AddFloat has a fatal assertion that
mandates that this arg is non-null.)

Differential Revision: https://phabricator.services.mozilla.com/D117218
2021-06-09 23:13:08 +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 fe7de81c74 Bug 1574046 Part 5 - Prevent BlockReflowInput::ClearFloat from returning nscoord_MAX. r=dbaron
This effectively makes ClearFloat() act like it always has
DONT_CLEAR_PUSHED_FLOATS. Thus, the flag is no longer needed.

We need to add an early return condition when the block cannot fit in
ReflowBlockFrame(). Because we now don't return nscoord_MAX when floats
are pushed or split, the `availSpace.BSize(wm)` might equal to zero
rather than negative in this case. It's needed by
testing/web-platform/tests/css/CSS2/floats-clear/floats-clear-multicol-003.html
and layout/reftests/pagination/float-clear-003-print.html

Differential Revision: https://phabricator.services.mozilla.com/D74540
2020-06-16 18:33:02 +00:00
Ting-Yu Lin d59f2e7540 Bug 1574046 Part 3 - Make BlockReflowInput::ClearFloats() return ClearFloatsResults. r=dbaron
This change doesn't change the behavior yet. It just changes all the
callers by having them catch the ClearFloatsResults.

Some of the callers will be revised in next patch by utilizing the
returned results. Some of the return values are not being used, and may
produce warnings, they will be suppressed in the next patch, too.

Differential Revision: https://phabricator.services.mozilla.com/D74538
2020-06-03 00:14:55 +00:00
Ting-Yu Lin e632178695 Bug 1625559 Part 2 - Use BlockReflowInput::ContentBEnd() to replace undocumented mBEndEdge. r=jfkthame
ContentBEnd() is equivalent to mBEndEdge except when ContentBSize() is
unconstrained because ContentBEnd() can overflow. However, according to
ContentBEnd()'s documentation, the user shouldn't use ContentBEnd() when
ContentBSize() is constrained, so I add an assertion in ContentBEnd() as
a reminder.

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

--HG--
extra : moz-landing-system : lando
2020-03-30 18:03:49 +00:00
Ting-Yu Lin d8dd5ea4ac Bug 1625559 Part 1 - Remove two unused BlockReflowInput flags. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D68623

--HG--
extra : moz-landing-system : lando
2020-03-30 13:21:46 +00:00
Ting-Yu Lin ee24bfab2a Bug 1575377 - Remove BlockReflowInput::mHasUnconstrainedBSize, and update documents. r=dholbert
The flag's original form `mUnconstrainedHeight` was added in
nsBlockReflowState.h in
e580331b37

Nowadays, we often check available block-size in reflow directly in nsBlockFrame.

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

--HG--
extra : moz-landing-system : lando
2019-08-21 19:53:08 +00:00
Ting-Yu Lin 0bc5f5330e Bug 1569701 Part 1 - Make BlockReflowInput::mConsumedBSize a constant, and delete it assessor method. r=dbaron
We always pass consumed block-size into BlockReflowInput's constructor
in nsBlockFrame::Reflow(). By making mConsumedBSize a constant, its
assessor method becomes redundant.

Update the documentation to reflect the reality that ConsumedBSize()
accumulates content block-size from all previous *continuations*, which
was done in Bug 1506293 Part 2.

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

--HG--
extra : moz-landing-system : lando
2019-08-15 16:49:14 +00:00
Ting-Yu Lin 83d9aa16f4 Bug 1571135 - Remove the preference that controls breaking floats inside columns. r=mats
Differential Revision: https://phabricator.services.mozilla.com/D40587

--HG--
extra : moz-landing-system : lando
2019-08-05 17:39:19 +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
Ting-Yu Lin 8e6b2d246c Bug 1550629 - Fix comments mentioning GetAvailableSpace. r=dholbert
GetAvailableSpace was renamed to GetFloatAvailableSpace in bug 25888.

DONTBUILD because this is a comment-only change.

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

--HG--
extra : moz-landing-system : lando
2019-05-10 21:06:48 +00:00
Cameron McCormack f5b7d1380b Bug 866102 - Implement -webkit-line-clamp. r=mats,emilio,dholbert
Differential Revision: https://phabricator.services.mozilla.com/D20115

--HG--
extra : moz-landing-system : lando
2019-05-09 02:32:30 +00:00
Ting-Yu Lin 16b761dfeb Bug 1543571 Part 0 - Adjust a comment to prevent it from being adjusted in Part 1. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D27161

--HG--
extra : moz-landing-system : lando
2019-04-11 20:51:42 +00:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Cosmin Sabou 3211507dfb Merge mozilla-inbound to mozilla-central. a=merge 2018-08-24 00:40:14 +03:00
Emilio Cobos Álvarez 2340488c8b Bug 1485430 - Simplify PlaceBelowCurrentFloats. r=dbaron,mats
No reason to pass our own member as an argument.

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

--HG--
extra : moz-landing-system : lando
2018-08-22 23:29:22 +00:00
Emilio Cobos Álvarez b6a59eedfc Bug 488725: Don't position floats in a nowrap context until hitting a break opportunity. r=dbaron
Differential Revision: https://phabricator.services.mozilla.com/D3900
2018-08-23 16:45:01 +02:00
Andi-Bogdan Postelnicu 5e3e0d4498 Bug 1453795 - Layout - Initialize member fields in classes/ structures. r=dbaron 2018-07-12 09:42:14 +03:00
Chris Peterson 2afd829d0f Bug 1469769 - Part 6: Replace non-failing NS_NOTREACHED with MOZ_ASSERT_UNREACHABLE. r=froydnj
This patch is an automatic replacement of s/NS_NOTREACHED/MOZ_ASSERT_UNREACHABLE/. Reindenting long lines and whitespace fixups follow in patch 6b.

MozReview-Commit-ID: 5UQVHElSpCr

--HG--
extra : rebase_source : 4c1b2fc32b269342f07639266b64941e2270e9c4
extra : source : 907543f6eae716f23a6de52b1ffb1c82908d158a
2018-06-17 22:43:11 -07:00
Cameron McCormack 284d195059 Bug 1469738 - Part 2: Replace mentions of "space manager" with "float manager" in comments. r=xidorn
MozReview-Commit-ID: 1BxlziyTEOM

--HG--
extra : rebase_source : 43ce3aa59773063454926b756dc9c2db1c9837e8
2018-06-05 15:33:42 +10:00
Sebastian Hengst 0819f35e51 Backed out 4 changesets (bug 525063) on request from Andi. a=backout
Backed out changeset 516c4fb1e4b8 (bug 525063)
Backed out changeset 6ff8aaef2866 (bug 525063)
Backed out changeset bf13e4103150 (bug 525063)
Backed out changeset d7d2f08e051c (bug 525063)
2018-04-13 16:01:28 +03:00
Tristan Bourvon a3a77c0312 Bug 525063 - Initialize uninitialized class attributes in m-c. r=ehsan 2018-04-10 21:11:02 +02:00
Daniel Holbert 680815cd6e Bug 1412346 part 5: (automated patch) Switch a bunch of C++ files in layout to use our standard mode lines. r=jfkthame
This patch was generated automatically by the "modeline.py" script, available
here: https://github.com/amccreight/moz-source-tools/blob/master/modeline.py

For every file that is modified in this patch, the changes are as follows:
 (1) The patch changes the file to use the exact C++ mode lines from the
     Mozilla coding style guide, available here:
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Mode_Line

 (2) The patch deletes any blank lines between the mode line & the MPL
     boilerplate comment.

 (3) If the file previously had the mode lines and MPL boilerplate in a
     single contiguous C++ comment, then the patch splits them into
     separate C++ comments, to match the boilerplate in the coding style.

MozReview-Commit-ID: EuRsDue63tK

--HG--
extra : rebase_source : 3356d4b80ff6213935192e87cdbc9103fec6084c
2017-10-27 10:33:53 -07:00
Mats Palmgren 76e3990b88 Bug 944200 part 1 - [css-ui] Make TextOverflow::CanHaveTextOverflow not take a nsDisplayListBuilder so we can use it in Reflow; cache the value in BlockReflowInput::mCanHaveTextOverflow. r=dholbert
MozReview-Commit-ID: 1wGE5svg1V9
2017-04-15 00:31:43 +02:00
Ting-Yu Lin 90c689bf56 Bug 1338443 Part 1 - Use ReflowInput's float manager in BlockReflowInput. r=dholbert
From the "NS_ASSERTION(mFloatManager)" statement in BlockReflowInput's
constructor, we know that BlockReflowInput's mFloatManager is always valid
and equals to aReflowInput.mFloatManager. Therefore, we could just use
ReflowInput's float manager in BlockReflowInput.

Due to the removal of BlockReflowInput's mFloatManager, the logic which
resets mFloatManager near the end of nsBlockFrame::Reflow() is removed as
well. It's safe because beyond that point, no other logic involves floats,
and |state| (i.e. BlockReflowInput) lives only on the stack.

MozReview-Commit-ID: 3dwXMnWkEI6

--HG--
extra : rebase_source : 7f9af1af10fd54456450b23bc0004dd5f15db4e4
2017-02-09 16:59:07 +08:00
Mats Palmgren 10150aa1b7 Bug 1232194 part 1 - [writing-mode] Drop "Get" from GetConsumedBSize() and add a WritingMode param. r=dholbert 2017-01-04 00:56:19 +01:00
Ting-Yu Lin 0bb55f9970 Bug 1309467 Part 4 - Implement <shape-box> values for shape-outside. r=dbaron
Per spec, float positioning and stacking is not affected by defining a float
area with a shape.
https://drafts.csswg.org/css-shapes/#relation-to-box-model-and-float-behavior

So all the call sites of GetFloatAvailableSpace() related to adding a
float are replaced by GetFloatAvailableSpaceForPlacingFloat().

<shape-box> with border-radius will be implemented in next part.

MozReview-Commit-ID: 1RXEeXDhdWo

--HG--
extra : rebase_source : 42cdb0c81b16168e4e30ee2261ceccb562e278cf
2016-10-12 16:06:25 +08:00
Ting-Yu Lin 384e9e119b Bug 1291110 Part 4 - Use line BSize to query available space when updating nsLineLayout. r=dbaron
In nsBlockFrame::PlaceLine(), we query the float available space by
using the line's BSize(), which may cause the line to reflow again due
to available space shrunk.

The first issue lies in the second reflow. That is, we do not leverage
the line's BSize() computed in the first reflow to query the float
available space when updating the inline reflow engine in
BlockReflowInput::AddFloat(). So some tall inline elements could still
overlap the floats as in the first reflow.

To solve this, we cache current line's BSize so that it could be
used to update the inline reflow engine when redo the line.

Another issue is in nsBlockFrame::PlaceLine(). When determined whether
the available space is shrunk, we use the float manager's state *before*
placing the line. So if current line has floats, they're not considered.

To solve this, we use the current set of floats to get the float available
space for comparison, and leave the original aFloatAvailableSpace to provide
the information when redoing the line.

MozReview-Commit-ID: GqqNlphgxYS

--HG--
extra : rebase_source : e2c64ab1ac363c7a08e532dc043bee69d6455049
2016-08-22 19:42:37 +08:00
Jeremy Chen c6d0429830 Bug 1297306 - part6:replace NS_STYLE_CLEAR_* with StyleClear enum class. r=xidorn
After using enum class, a switch-case warning in CombineBreakType is caught.
This is one of such kind safty checks that we would like to gain.
Fix it by adding default case for switch-case in CombineBreakType.

MozReview-Commit-ID: BdS3LPN6qzX

--HG--
extra : rebase_source : 17f24a0d482ed6eb51b23e6942d0ac1c87375e0b
2016-09-07 10:20:17 +08:00
Xidorn Quan 57e31c7faa Bug 1260031 followup - Remove unused parameter of BlockReflowInput::ComputeBlockAvailSpace. r=dbaron
MozReview-Commit-ID: 7ZZ0xw9l4YZ

--HG--
extra : rebase_source : 7b0c0138cf1af76608db4fb997c313a590ef054e
2016-08-22 21:39:54 +10:00
Ting-Yu Lin 151d2fc6c8 Bug 1294628 - Replace block reflow input flags with a bit fields struct. r=dholbert
MozReview-Commit-ID: 2ZSm9hTrsuh

--HG--
extra : rebase_source : 2d44e6c8e1856274d466ed1c523ff6cbf793b4e7
2016-08-12 15:28:45 +08:00
Ting-Yu Lin 40fcd21b9a Bug 1277129 Part 7b - Rename various ReflowState variables to ReflowInput. r=dbaron
This patch is generated by the following script:

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

rename "([[:alpha:]]*)([rR])eflowState(s?)" "\1\2eflowInput\3"

MozReview-Commit-ID: ITFO7uMTkSb

--HG--
extra : rebase_source : c91a2e174a0baec60c1b0111ac7636295004ab35
2016-07-21 18:36:39 +08:00
Ting-Yu Lin 6111a2de40 Bug 1277129 Part 2c - Rename nsBlockReflowState to BlockReflowInput. r=dbaron
This patch is generated by the following script:

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 "nsBlockReflowState" "BlockReflowInput"

MozReview-Commit-ID: FtjqkQpGfcI

--HG--
extra : rebase_source : c8f678bc47217b778df7f91f0f6cce6c44b04d90
2016-07-21 18:36:36 +08:00
Ting-Yu Lin 371989a096 Bug 1277129 Part 2b - Rename nsBlockReflowState.h/cpp to BlockReflowInput.h/cpp and fix #includes. r=dbaron
The #includes are fixed by the following script:

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 "nsBlockReflowState\.h" "BlockReflowInput\.h"

MozReview-Commit-ID: 6QMqko1XOsT

--HG--
rename : layout/generic/nsBlockReflowState.cpp => layout/generic/BlockReflowInput.cpp
rename : layout/generic/nsBlockReflowState.h => layout/generic/BlockReflowInput.h
extra : rebase_source : 8911b9bbe68ceca82c77b7e120d87bfa71b7211c
2016-07-21 18:36:36 +08:00