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, ...@@ -38,7 +38,8 @@ bool NGBox::Layout(const NGConstraintSpace* constraint_space,
// Change the coordinate system of the constraint space. // Change the coordinate system of the constraint space.
NGConstraintSpace* child_constraint_space = new NGConstraintSpace( NGConstraintSpace* child_constraint_space = new NGConstraintSpace(
FromPlatformWritingMode(Style()->getWritingMode()), FromPlatformWritingMode(Style()->getWritingMode()),
FromPlatformDirection(Style()->direction()), constraint_space); FromPlatformDirection(Style()->direction()),
constraint_space->MutablePhysicalSpace());
NGPhysicalFragment* fragment = nullptr; NGPhysicalFragment* fragment = nullptr;
if (!algorithm_->Layout(child_constraint_space, &fragment)) if (!algorithm_->Layout(child_constraint_space, &fragment))
......
...@@ -11,15 +11,6 @@ ...@@ -11,15 +11,6 @@
namespace blink { 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, NGConstraintSpace::NGConstraintSpace(NGWritingMode writing_mode,
NGDirection direction, NGDirection direction,
NGPhysicalConstraintSpace* physical_space) NGPhysicalConstraintSpace* physical_space)
...@@ -30,10 +21,10 @@ NGConstraintSpace::NGConstraintSpace(NGWritingMode writing_mode, ...@@ -30,10 +21,10 @@ NGConstraintSpace::NGConstraintSpace(NGWritingMode writing_mode,
NGConstraintSpace::NGConstraintSpace(NGWritingMode writing_mode, NGConstraintSpace::NGConstraintSpace(NGWritingMode writing_mode,
NGDirection direction, NGDirection direction,
const NGConstraintSpace* constraint_space) NGLogicalSize container_size)
: physical_space_(constraint_space->MutablePhysicalSpace()), : physical_space_(new NGPhysicalConstraintSpace(
offset_(constraint_space->Offset()), container_size.ConvertToPhysical(writing_mode))),
size_(constraint_space->Size()), size_(container_size),
writing_mode_(writing_mode), writing_mode_(writing_mode),
direction_(direction) {} direction_(direction) {}
......
...@@ -25,25 +25,22 @@ class NGLayoutOpportunityIterator; ...@@ -25,25 +25,22 @@ class NGLayoutOpportunityIterator;
class CORE_EXPORT NGConstraintSpace final class CORE_EXPORT NGConstraintSpace final
: public GarbageCollected<NGConstraintSpace> { : public GarbageCollected<NGConstraintSpace> {
public: 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 // Constructs a constraint space based on an existing backing
// NGPhysicalConstraintSpace. Sets this constraint space's size to the // NGPhysicalConstraintSpace. Sets this constraint space's size to the
// physical constraint space's container size, converted to logical // physical constraint space's container size, converted to logical
// coordinates. // coordinates.
// TODO(layout-ng): Do we need this constructor?
NGConstraintSpace(NGWritingMode, NGDirection, NGPhysicalConstraintSpace*); NGConstraintSpace(NGWritingMode, NGDirection, NGPhysicalConstraintSpace*);
// Constructs a constraint space with a different NGWritingMode and // Constructs a constraint space with a new backing NGPhysicalConstraintSpace.
// NGDirection that's otherwise identical. // The size will be used for both for the physical constraint space's
NGConstraintSpace(NGWritingMode, NGDirection, const NGConstraintSpace*); // 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 // Constructs a derived constraint space sharing the same backing
// NGPhysicalConstraintSpace, NGWritingMode and NGDirection. Primarily for use // NGPhysicalConstraintSpace, NGWritingMode and NGDirection. Primarily for use
// by NGLayoutOpportunityIterator. // by NGLayoutOpportunityIterator.
// TODO(layout-dev): Remove once NGConstraintSpaceBuilder exists.
NGConstraintSpace(const NGConstraintSpace& other, NGConstraintSpace(const NGConstraintSpace& other,
NGLogicalOffset, NGLogicalOffset,
NGLogicalSize); NGLogicalSize);
...@@ -52,6 +49,7 @@ class CORE_EXPORT NGConstraintSpace final ...@@ -52,6 +49,7 @@ class CORE_EXPORT NGConstraintSpace final
// input constraint space, but has a different container size, writing mode // input constraint space, but has a different container size, writing mode
// and direction. Sets the offset to zero. For use by layout algorithms // and direction. Sets the offset to zero. For use by layout algorithms
// to use as the basis to find layout opportunities for children. // to use as the basis to find layout opportunities for children.
// TODO(layout-dev): Remove once NGConstraintSpaceBuilder exists.
NGConstraintSpace(NGWritingMode, NGConstraintSpace(NGWritingMode,
NGDirection, NGDirection,
const NGConstraintSpace& other, const NGConstraintSpace& other,
......
...@@ -20,8 +20,8 @@ TEST(NGConstraintSpaceTest, WritingMode) { ...@@ -20,8 +20,8 @@ TEST(NGConstraintSpaceTest, WritingMode) {
horz_space->SetFixedSize(true, false); horz_space->SetFixedSize(true, false);
horz_space->SetFragmentationType(FragmentColumn); horz_space->SetFragmentationType(FragmentColumn);
NGConstraintSpace* vert_space = NGConstraintSpace* vert_space = new NGConstraintSpace(
new NGConstraintSpace(VerticalRightLeft, LeftToRight, horz_space); VerticalRightLeft, LeftToRight, horz_space->MutablePhysicalSpace());
EXPECT_EQ(LayoutUnit(200), horz_space->ContainerSize().inline_size); EXPECT_EQ(LayoutUnit(200), horz_space->ContainerSize().inline_size);
EXPECT_EQ(LayoutUnit(200), vert_space->ContainerSize().block_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