Instead of manually adding (aLineLeft, aBlockStart) when creating a shape,
add Translate() to let the shapes implement their only way to move their
origin. FloatInfo could then move the shapes after they're created.
MozReview-Commit-ID: ApZBHnkng74
--HG--
extra : rebase_source : 10da425372e4e26b0da506059befc99e1c47a39d
circle() allows the user to define an empty flow area, so IsEmpty() needs to
be overridden.
The flow area defined by a shape needs to be clipped to the margin-box per
https://drafts.csswg.org/css-shapes/#relation-to-box-model-and-float-behavior
In the reftests, both clip-path and shape-outside uses the same value so
that it's easier to debug visually.
Add LogicalPoint::LineRelative() because we need to convert a point's I() to
the line-axis in nsFloatManager. LineRelative() differs from I() in all
'rtl' direction per
https://drafts.csswg.org/css-writing-modes-3/#logical-to-physical
MozReview-Commit-ID: FxQaFPrEQ73
--HG--
extra : rebase_source : 0d768002a38adbded2a0caa6d3e001eaaca3313d
Create ShapeInfo as a base class for implementing all the shapes. In this
design, we only need to create the correct subclass in FloatInfo's
constructor whenever shape-outside is used rather than manually branching on
StyleShapeSourceType and StyleBasicShape in all the methods like
LineRight(), LineLeft(), etc.
The concrete subclass of ShapeInfo could focus on implementing how its shape
influence the flow area by overriding the needed methods in ShapeInfo.
Move ComputeEllipseLineInterceptDiff() and XInterceptAtY() under the scope
of ShapeInfo so that they could be used by BoxShapeInfo and all the other
ShpapeInfo subclasses yet to come.
MozReview-Commit-ID: ETVc5FdGNha
--HG--
extra : rebase_source : 9a083ccd95fd7565112a45e30c15a91b97c7290f
Use move constructor for two reasons. 1) The copy constructor is needed only
when appending FloatInfo to mFloats, so using move constructor will likely
be more efficient if some of the member variables support move constructor.
2) Part 6 will added a UniquePtr member to FloatInfo, so using move
constructor becomes necessary.
Also change the return value of AddFloat() to void to simplify the code,
since all the other callers do not check the return value, and
BlockReflowInput::FloatAndPlaceFloat() only asserts in debug mode. I assume
it's safe to omit the OOM check.
MozReview-Commit-ID: GVbbsdBjr7b
--HG--
extra : rebase_source : e0f647e029278a5033bb9d6d780e73e32de460d3
circle() allows the user to define an empty flow area, so IsEmpty() needs to
be overridden.
The flow area defined by a shape needs to be clipped to the margin-box per
https://drafts.csswg.org/css-shapes/#relation-to-box-model-and-float-behavior
In the reftests, both clip-path and shape-outside uses the same value so
that it's easier to debug visually.
Add LogicalPoint::LineRelative() because we need to convert a point's I() to
the line-axis in nsFloatManager. LineRelative() differs from I() in all
'rtl' direction per
https://drafts.csswg.org/css-writing-modes-3/#logical-to-physical
MozReview-Commit-ID: FxQaFPrEQ73
--HG--
extra : rebase_source : 0d768002a38adbded2a0caa6d3e001eaaca3313d
Create ShapeInfo as a base class for implementing all the shapes. In this
design, we only need to create the correct subclass in FloatInfo's
constructor whenever shape-outside is used rather than manually branching on
StyleShapeSourceType and StyleBasicShape in all the methods like
LineRight(), LineLeft(), etc.
The concrete subclass of ShapeInfo could focus on implementing how its shape
influence the flow area by overriding the needed methods in ShapeInfo.
Move ComputeEllipseLineInterceptDiff() and XInterceptAtY() under the scope
of ShapeInfo so that they could be used by BoxShapeInfo and all the other
ShpapeInfo subclasses yet to come.
MozReview-Commit-ID: ETVc5FdGNha
--HG--
extra : rebase_source : 9a083ccd95fd7565112a45e30c15a91b97c7290f
Use move constructor for two reasons. 1) The copy constructor is needed only
when appending FloatInfo to mFloats, so using move constructor will likely
be more efficient if some of the member variables support move constructor.
2) Part 6 will added a UniquePtr member to FloatInfo, so using move
constructor becomes necessary.
Also change the return value of AddFloat() to void to simplify the code,
since all the other callers do not check the return value, and
BlockReflowInput::FloatAndPlaceFloat() only asserts in debug mode. I assume
it's safe to omit the OOM check.
MozReview-Commit-ID: GVbbsdBjr7b
--HG--
extra : rebase_source : e0f647e029278a5033bb9d6d780e73e32de460d3
circle() allows the user to define an empty flow area, so IsEmpty() needs to
be overridden.
The flow area defined by a shape needs to be clipped to the margin-box per
https://drafts.csswg.org/css-shapes/#relation-to-box-model-and-float-behavior
In the reftests, both clip-path and shape-outside uses the same value so
that it's easier to debug visually.
Add LogicalPoint::LineRelative() because we need to convert a point's I() to
the line-axis in nsFloatManager. LineRelative() differs from I() in all
'rtl' direction per
https://drafts.csswg.org/css-writing-modes-3/#logical-to-physical
MozReview-Commit-ID: FxQaFPrEQ73
--HG--
extra : rebase_source : 02b4eafdff42477ef2c69d604a1650db01f954e4
Create ShapeInfo as a base class for implementing all the shapes. In this
design, we only need to create the correct subclass in FloatInfo's
constructor whenever shape-outside is used rather than manually branching on
StyleShapeSourceType and StyleBasicShape in all the methods like
LineRight(), LineLeft(), etc.
The concrete subclass of ShapeInfo could focus on implementing how its shape
influence the flow area by overriding the needed methods in ShapeInfo.
Move ComputeEllipseLineInterceptDiff() and XInterceptAtY() under the scope
nsFloatManager so that they could be used by BoxShapeInfo and all the other
ShpapeInfo subclasses yet to come.
MozReview-Commit-ID: ETVc5FdGNha
--HG--
extra : rebase_source : c73b0d0be2350db3eedb61b565de194842352ba1
Use move constructor for two reasons. 1) The copy constructor is needed only
when appending FloatInfo to mFloats, so using move constructor will likely
be more efficient if some of the member variables support move constructor.
2) Part 6 will added a UniquePtr member to FloatInfo, so using move
constructor becomes necessary.
Also change the return value of AddFloat() to void to simplify the code,
since all the other callers do not check the return value, and
BlockReflowInput::FloatAndPlaceFloat() only asserts in debug mode. I assume
it's safe to omit the OOM check.
MozReview-Commit-ID: GVbbsdBjr7b
--HG--
extra : rebase_source : 4765bbcf5c2533845bd8f7fb00117983429a622e
This patch is just renames. No logic change for the function.
MozReview-Commit-ID: K7w0YL3G3gu
--HG--
extra : rebase_source : d72ecdcb4d4455f4950c8673c81fbfc7c1b4f54c
The tests cases are designed based on the integer solution to the ellipse
equation (x/a)^2 + (y/b)^2 = 1, where x=36, y=32, a=60, b=40.
MozReview-Commit-ID: De2fXcb6ypP
--HG--
extra : rebase_source : a64f490ff41c020b84025266c0c255d93a158eea
In GetFlowArea(), "Shrink our band's height if needed." computation was
moved to the end because we need to pass the unmodified |blockEnd| to
compute LineRight() and LineLeft().
Revamp OutsetBorderRadii() to allow negative margin to reduce the radius,
but not below zero. Also implement the cubic formula required by the spec.
https://drafts.csswg.org/css-shapes/#valdef-shape-box-margin-box
OutsetBorderRadii() is now tailored only for margin-box with border-radius,
so it might no longer be suitable for other scenarios.
MozReview-Commit-ID: HKxW7rp6sIA
--HG--
extra : rebase_source : d416433016304feefc9ed9dcd1c22f7f2f92e27e
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
In later parts, we need the aMarginRect to build rect for shape box.
MozReview-Commit-ID: LtwMxbsNu3u
--HG--
extra : rebase_source : eee35663458079026b14922499b566674b2680ac
Also exchange the order of the second argument |aBSize| and the third
argument |aBandInfo| for GetFlowArea() so that aBCoord and aBSize are
grouped together. And it'll be prettier to add ShapeInfo behind BandInfo
in later part.
MozReview-Commit-ID: cusdomjUyu
--HG--
extra : rebase_source : 8a7dca7179f1a05d380473d5d56d984bbe8aa97f
The operator new is infallable. Also change the return value to void
accordingly. The only caller doesn't even check the return value.
MozReview-Commit-ID: 3whf7s1d35q
--HG--
extra : rebase_source : 6c3a7010f77dad0ee5f50408205fc3a5418dacc9
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