Closed Bug 1689504 Opened 4 years ago Closed 4 years ago

Consider adding optional border & padding parameters to SizeComputationInput's constructor

Categories

(Core :: Layout, task)

task

Tracking

()

RESOLVED FIXED
87 Branch
Tracking Status
firefox87 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

Details

Attachments

(4 files)

Consider adding optional border & padding parameters to SizeComputationInput's constructor so that caller can pass in customized border & padding into SizeComputationInput::Init(). ReflowInput::Init() already have the ability.

One use case is when constructing a ReflowInput for a border-collapsed nsTableFrame, we need to pass customized border [1]. But if we only want a basic SizeComputationInput for a border-collapsed nsTableFrame, the border is calculated as a special case in SizeComutationInput::InitOffsets [3] because currently there's no way to provided a customized border into SizeComputationInput.

[1] https://searchfox.org/mozilla-central/rev/4f07d49f1c7a823da07e3a231ac87c6435c8fd58/layout/tables/nsTableWrapperFrame.cpp#237-240,257
[2] https://searchfox.org/mozilla-central/rev/4f07d49f1c7a823da07e3a231ac87c6435c8fd58/layout/tables/nsTableWrapperFrame.cpp#342-343
[3] https://searchfox.org/mozilla-central/rev/4f07d49f1c7a823da07e3a231ac87c6435c8fd58/layout/generic/ReflowInput.cpp#2500-2511

Bug 1688690 has ensured inner table's computed margins are all zero.
Here, the only caller is asking the margin of the inner table, which is
always 0. Hence this patch.

If the table wrapper frame has a caption, we don't need to compute the
flags twice, because the flag can be determined solely by table wrapper
frame's properties.

Depends on D104348

When creating a ReflowInput for inner table frame, we pass the customize
border & padding if the table frame is border-collapsed (in
CreateReflowInputForInnerTable()).

Similarly, when creating a SizeComputationInput for inner table frame,
we should be able to pass border & padding rather have some specialized
code in SizeComputationInput::InitOffsets().

Depends on D104349

The old code used to compute margins for table frame, and nuke it
afterwards. We can save some time by moving the code setting zero
margins into ComputeMargin().

Depends on D104350

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/a735d09ecabf Part 1 - Remove the output margin parameter on nsTableWrapperFrame::ChildShrinkWrapISize(). r=emilio https://hg.mozilla.org/integration/autoland/rev/124c504f282b Part 2 - Move the computation of ComputeSizeFlag from ComputeAutoSize() to ChildShrinkWrapISize(). r=emilio https://hg.mozilla.org/integration/autoland/rev/5d3dbe766512 Part 3 - Remove the specialized code to set a collapsed table's border & padding in SizeComputationInput. r=emilio https://hg.mozilla.org/integration/autoland/rev/7a4c9469e940 Part 4 - Set zero margins for table frame in ComputeMargin(). r=emilio
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: