Closed Bug 1546223 Opened 6 years ago Closed 6 years ago

Cleanup ReflowInput a bit

Categories

(Core :: Layout, task, P3)

task

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

Details

Attachments

(6 files)

Some cleanup in ReflowInput's constructor and the setup of containing block size.

There are some minor behavior changes.

  1. Change the default containing block size from
    Logical(mWritingMode, -1, -1) to
    LogicalSize(mWritingMode, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE).

  2. Move DISPLAY_INIT_CONSTRAINTS() to the very bottom of
    ReflowInput::InitConstraints() to have it dumps containing block size
    calculated by ComputeContainingBlockRectangle(). It's not very useful
    to dump the default size if it were at the beginning of the method.

  3. mContainingBlockSize is starting to cache the value computed by
    ComputeContainingBlockRectangle(). It is only used by
    nsTableWrapperFrame::InitChildReflowInput(), but can be useful in
    other places.

Attachment #9059971 - Attachment description: Bug 1546223 Part 4 - Remove unused NOISY_VERTICAL_ALIGN. → Bug 1546223 Part 0 - Remove unused NOISY_VERTICAL_ALIGN.
Attachment #9059969 - Attachment description: Bug 1546223 Part 2 - Initialize ReflowInput's member variables in the header (for those which were in initializer list). → Bug 1546223 Part 2 - Use in-class member initializer for those which were in initializer list.
Attachment #9059970 - Attachment description: Bug 1546223 Part 3 - Initialize ReflowInput's member variables in the header (for those which were in the body of constructor). → Bug 1546223 Part 3 - Use in-class member initializer for those which were in constructor body.

MOZ_INIT_OUTSIDE_CTOR just disables the static check that the member
variable must be initialized in the constructor. Giving the member
variable a default value would be clearer.

Depends on D28428

Attachment #9059995 - Attachment description: Bug 1546223 Part 4 - Use in-class member initializer for rest of the variables. → Bug 1546223 Part 4 - Use in-class member initializer for the rest of the member variables.
Attachment #9059969 - Attachment description: Bug 1546223 Part 2 - Use in-class member initializer for those which were in initializer list. → Bug 1546223 Part 1 - Use in-class member initializer for those which were in initializer list.
Attachment #9059970 - Attachment description: Bug 1546223 Part 3 - Use in-class member initializer for those which were in constructor body. → Bug 1546223 Part 2 - Use in-class member initializer for those which were in constructor body.
Attachment #9059995 - Attachment description: Bug 1546223 Part 4 - Use in-class member initializer for the rest of the member variables. → Bug 1546223 Part 3 - Use in-class member initializer for some of the member variables.
Attachment #9059968 - Attachment description: Bug 1546223 Part 1 - Use Maybe instead a pointer for ReflowInput's optional containing block size. → Bug 1546223 Part 4 - Mechanically replace pointer with Maybe for ReflowInput's optional containing block size.

There are some minor behavior changes come with this.

  1. Change the default containing block size to (NS_UNCONSTRAINEDSIZE,
    NS_UNCONSTRAINEDSIZE). I think this is more reasonable than (-1, -1).

  2. Move DISPLAY_INIT_CONSTRAINTS() to the very bottom of
    ReflowInput::InitConstraints() to have it dumps containing block size
    calculated by ComputeContainingBlockRectangle(). It's not very useful
    to dump the default size if it were at the beginning of the method.

  3. mContainingBlockSize is used to cache only the block size passing
    though constructor, Init(), or the invalid (-1, -1). This patch makes
    it cache the value computed by ComputeContainingBlockRectangle().

    Note that mContainingBlockSize is used only in
    nsTableWrapperFrame::InitChildReflowInput() to set the inner table
    frame's containing block to be the same as the outer table frame's.
    We don't change this behavior by caching more. Because even if the
    inner frame use the invalid cached (-1, -1) containing block size
    from the outer reflow input, it still computes the block size again
    in InitConstraints(). (Inner table's cb is the same as the outer
    table's per InitCBReflowInput().)

Depends on D28426

Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/18c6cc260c27 Part 0 - Remove unused NOISY_VERTICAL_ALIGN. r=dholbert https://hg.mozilla.org/integration/autoland/rev/3cd891607bf6 Part 1 - Use in-class member initializer for those which were in initializer list. r=dholbert https://hg.mozilla.org/integration/autoland/rev/7bfdaa5f19d8 Part 2 - Use in-class member initializer for those which were in constructor body. r=dholbert https://hg.mozilla.org/integration/autoland/rev/d59741bdae0b Part 3 - Use in-class member initializer for some of the member variables. r=dholbert https://hg.mozilla.org/integration/autoland/rev/b23e64dd2c7b Part 4 - Mechanically replace pointer with Maybe for ReflowInput's optional containing block size. r=dholbert https://hg.mozilla.org/integration/autoland/rev/e5029a42a612 Part 5 - Change ReflowInput::InitConstraints() to use Maybe for containing block size. r=dholbert
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: