Commit ce86bdc2 authored by ikilpatrick's avatar ikilpatrick Committed by Commit bot

[LayoutNG] Remove one NGConstraintSpace constructor, mark others for removal.

Once the builder is added only the:
NGConstraintSpace(NGWritingMode, NGDirection, NGPhysicalConstraintSpace*)

should remain, this mirrors the NGFragment constructor which is just a "view"
on top of the NGPhysicalFragment.

This mirrors:
NGFragment(NGWritingMode, NGDirection, NGPhysicalFragment*)

BUG=635619

Review-Url: https://chromiumcodereview.appspot.com/2442123002
Cr-Commit-Position: refs/heads/master@{#426995}
parent af4072ec
......@@ -38,7 +38,8 @@ bool NGBox::Layout(const NGConstraintSpace* constraint_space,
// Change the coordinate system of the constraint space.
NGConstraintSpace* child_constraint_space = new NGConstraintSpace(
FromPlatformWritingMode(Style()->getWritingMode()),
FromPlatformDirection(Style()->direction()), constraint_space);
FromPlatformDirection(Style()->direction()),
constraint_space->MutablePhysicalSpace());
NGPhysicalFragment* fragment = nullptr;
if (!algorithm_->Layout(child_constraint_space, &fragment))
......
......@@ -11,15 +11,6 @@
namespace blink {
NGConstraintSpace::NGConstraintSpace(NGWritingMode writing_mode,
NGDirection direction,
NGLogicalSize container_size)
: physical_space_(new NGPhysicalConstraintSpace(
container_size.ConvertToPhysical(writing_mode))),
size_(container_size),
writing_mode_(writing_mode),
direction_(direction) {}
NGConstraintSpace::NGConstraintSpace(NGWritingMode writing_mode,
NGDirection direction,
NGPhysicalConstraintSpace* physical_space)
......@@ -30,10 +21,10 @@ NGConstraintSpace::NGConstraintSpace(NGWritingMode writing_mode,
NGConstraintSpace::NGConstraintSpace(NGWritingMode writing_mode,
NGDirection direction,
const NGConstraintSpace* constraint_space)
: physical_space_(constraint_space->MutablePhysicalSpace()),
offset_(constraint_space->Offset()),
size_(constraint_space->Size()),
NGLogicalSize container_size)
: physical_space_(new NGPhysicalConstraintSpace(
container_size.ConvertToPhysical(writing_mode))),
size_(container_size),
writing_mode_(writing_mode),
direction_(direction) {}
......
......@@ -25,25 +25,22 @@ class NGLayoutOpportunityIterator;
class CORE_EXPORT NGConstraintSpace final
: public GarbageCollected<NGConstraintSpace> {
public:
// Constructs a constraint space with a new backing NGPhysicalConstraintSpace.
// The size will be used for both for the physical constraint space's
// container size and this constraint space's Size().
NGConstraintSpace(NGWritingMode, NGDirection, NGLogicalSize);
// Constructs a constraint space based on an existing backing
// NGPhysicalConstraintSpace. Sets this constraint space's size to the
// physical constraint space's container size, converted to logical
// coordinates.
// TODO(layout-ng): Do we need this constructor?
NGConstraintSpace(NGWritingMode, NGDirection, NGPhysicalConstraintSpace*);
// Constructs a constraint space with a different NGWritingMode and
// NGDirection that's otherwise identical.
NGConstraintSpace(NGWritingMode, NGDirection, const NGConstraintSpace*);
// Constructs a constraint space with a new backing NGPhysicalConstraintSpace.
// The size will be used for both for the physical constraint space's
// container size and this constraint space's Size().
// TODO(layout-dev): Remove once NGConstraintSpaceBuilder exists.
NGConstraintSpace(NGWritingMode, NGDirection, NGLogicalSize);
// Constructs a derived constraint space sharing the same backing
// NGPhysicalConstraintSpace, NGWritingMode and NGDirection. Primarily for use
// by NGLayoutOpportunityIterator.
// TODO(layout-dev): Remove once NGConstraintSpaceBuilder exists.
NGConstraintSpace(const NGConstraintSpace& other,
NGLogicalOffset,
NGLogicalSize);
......@@ -52,6 +49,7 @@ class CORE_EXPORT NGConstraintSpace final
// input constraint space, but has a different container size, writing mode
// and direction. Sets the offset to zero. For use by layout algorithms
// to use as the basis to find layout opportunities for children.
// TODO(layout-dev): Remove once NGConstraintSpaceBuilder exists.
NGConstraintSpace(NGWritingMode,
NGDirection,
const NGConstraintSpace& other,
......
......@@ -20,8 +20,8 @@ TEST(NGConstraintSpaceTest, WritingMode) {
horz_space->SetFixedSize(true, false);
horz_space->SetFragmentationType(FragmentColumn);
NGConstraintSpace* vert_space =
new NGConstraintSpace(VerticalRightLeft, LeftToRight, horz_space);
NGConstraintSpace* vert_space = new NGConstraintSpace(
VerticalRightLeft, LeftToRight, horz_space->MutablePhysicalSpace());
EXPECT_EQ(LayoutUnit(200), horz_space->ContainerSize().inline_size);
EXPECT_EQ(LayoutUnit(200), vert_space->ContainerSize().block_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment