Commit 54fcb574 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[LayoutNG] Match new spec wrt. percentage text-indent.

It's now to be resolved against the inline-size of the content area of
the block itself [1]. Already fixed for legacy layout here:
https://chromium-review.googlesource.com/c/chromium/src/+/1285109

We no longer need PercentageResolutionInlineSize().

[1] https://github.com/w3c/csswg-drafts/issues/2394#issuecomment-380429078

Bug: 884588
Change-Id: I7526bbdbab4cfc31cdfb4c8e1d83450e9d1eee1a
Reviewed-on: https://chromium-review.googlesource.com/c/1292874Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601614}
parent a258b1fa
......@@ -59,7 +59,6 @@ crbug.com/591099 fast/dom/nodesFromRect/nodesFromRect-basic.html [ Failure ]
# New failures are appended below by the script.
crbug.com/728378 compositing/culling/tile-occlusion-boundaries.html [ Failure ]
crbug.com/864398 compositing/iframes/floating-self-painting-frame.html [ Failure ]
crbug.com/591099 css2.1/t1601-c547-indent-01-d.html [ Failure ]
crbug.com/591099 css3/filters/composited-layer-child-bounds-after-composited-to-sw-shadow-change.html [ Failure ]
crbug.com/591099 editing/selection/paint-hyphen.html [ Pass ]
crbug.com/591099 external/wpt/content-security-policy/generic/only-valid-whitespaces-are-allowed.html [ Pass ]
......@@ -72,7 +71,6 @@ crbug.com/591099 external/wpt/css/CSS2/normal-flow/block-in-inline-insert-001h.x
crbug.com/591099 external/wpt/css/CSS2/normal-flow/block-in-inline-insert-002e.xht [ Pass ]
crbug.com/591099 external/wpt/css/CSS2/normal-flow/block-in-inline-nested-002.xht [ Pass ]
crbug.com/591099 external/wpt/css/CSS2/normal-flow/block-in-inline-remove-006.xht [ Pass ]
crbug.com/591099 external/wpt/css/CSS2/text/text-indent-percent-001.xht [ Pass ]
crbug.com/591099 external/wpt/css/CSS2/text/white-space-mixed-003.xht [ Pass ]
crbug.com/714962 external/wpt/css/css-fonts/font-features-across-space-1.html [ Pass ]
crbug.com/714962 external/wpt/css/css-fonts/font-features-across-space-3.html [ Pass ]
......@@ -85,10 +83,6 @@ crbug.com/591099 external/wpt/css/css-text/line-breaking/line-breaking-ic-002.ht
crbug.com/591099 external/wpt/css/css-text/line-breaking/line-breaking-ic-003.html [ Pass ]
crbug.com/591099 external/wpt/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html [ Pass ]
crbug.com/591099 external/wpt/css/css-text/overflow-wrap/overflow-wrap-min-content-size-003.html [ Pass ]
crbug.com/591099 external/wpt/css/css-text/text-indent/text-indent-percentage-001.xht [ Pass ]
crbug.com/591099 external/wpt/css/css-text/text-indent/text-indent-percentage-002.html [ Failure ]
crbug.com/591099 external/wpt/css/css-text/text-indent/text-indent-percentage-003.html [ Failure ]
crbug.com/591099 external/wpt/css/css-text/text-indent/text-indent-percentage-004.html [ Failure ]
crbug.com/591099 external/wpt/css/css-text/white-space/line-edge-white-space-collapse-001.html [ Pass ]
crbug.com/591099 external/wpt/css/css-text/white-space/line-edge-white-space-collapse-002.html [ Pass ]
crbug.com/591099 external/wpt/css/css-text/white-space/pre-wrap-002.html [ Pass ]
......
......@@ -34,17 +34,12 @@ void NGLineInfo::SetLineStyle(const NGInlineNode& node,
line_style_ = node.GetLayoutBox()->Style(use_first_line_style_);
if (line_style_->ShouldUseTextIndent(is_first_line, is_after_forced_break)) {
// 'text-indent' applies to block container, and percentage is of its
// containing block.
// https://drafts.csswg.org/css-text-3/#valdef-text-indent-percentage
// In our constraint space tree, parent constraint space is of its
// containing block.
// TODO(kojii): ComputeMinMaxSize does not know parent constraint
// space that we cannot compute percent for text-indent.
const Length& length = line_style_->TextIndent();
LayoutUnit maximum_value;
if (length.IsPercentOrCalc())
maximum_value = constraint_space.ParentPercentageResolutionInlineSize();
maximum_value = constraint_space.AvailableSize().inline_size;
text_indent_ = MinimumValueForLength(length, maximum_value);
} else {
text_indent_ = LayoutUnit();
......
......@@ -22,10 +22,6 @@ NGConstraintSpace::NGConstraintSpace(WritingMode out_writing_mode,
percentage_resolution_size_(builder.percentage_resolution_size_),
replaced_percentage_resolution_size_(
builder.replaced_percentage_resolution_size_),
parent_percentage_resolution_inline_size_(
builder.parent_percentage_resolution_size_
.value_or(percentage_resolution_size_)
.inline_size),
initial_containing_block_size_(builder.initial_containing_block_size_),
fragmentainer_block_size_(builder.fragmentainer_block_size_),
fragmentainer_space_at_bfc_start_(
......@@ -56,10 +52,6 @@ NGConstraintSpace::NGConstraintSpace(WritingMode out_writing_mode,
available_size_.Flip();
percentage_resolution_size_.Flip();
replaced_percentage_resolution_size_.Flip();
parent_percentage_resolution_inline_size_ =
builder.parent_percentage_resolution_size_
.value_or(percentage_resolution_size_)
.block_size;
// Swap the fixed size block/inline flags
bool fixed_size_block = flags_ & kFixedSizeBlock;
bool fixed_size_inline = flags_ & kFixedSizeInline;
......@@ -241,20 +233,11 @@ NGConstraintSpace::PercentageResolutionInlineSizeForParentWritingMode() const {
return InitialContainingBlockSize().width;
}
LayoutUnit NGConstraintSpace::ParentPercentageResolutionInlineSize() const {
if (parent_percentage_resolution_inline_size_ != NGSizeIndefinite)
return parent_percentage_resolution_inline_size_;
return initial_containing_block_size_.ConvertToLogical(GetWritingMode())
.inline_size;
}
bool NGConstraintSpace::operator==(const NGConstraintSpace& other) const {
return available_size_ == other.available_size_ &&
percentage_resolution_size_ == other.percentage_resolution_size_ &&
replaced_percentage_resolution_size_ ==
other.replaced_percentage_resolution_size_ &&
parent_percentage_resolution_inline_size_ ==
other.parent_percentage_resolution_inline_size_ &&
initial_containing_block_size_ ==
other.initial_containing_block_size_ &&
fragmentainer_block_size_ == other.fragmentainer_block_size_ &&
......
......@@ -107,10 +107,6 @@ class CORE_EXPORT NGConstraintSpace final {
// writing mode.
LayoutUnit PercentageResolutionInlineSizeForParentWritingMode() const;
// Parent's PercentageResolutionInlineSize().
// This is not always available.
LayoutUnit ParentPercentageResolutionInlineSize() const;
// The available space size.
// See: https://drafts.csswg.org/css-sizing/#available
NGLogicalSize AvailableSize() const { return available_size_; }
......@@ -302,7 +298,6 @@ class CORE_EXPORT NGConstraintSpace final {
NGLogicalSize available_size_;
NGLogicalSize percentage_resolution_size_;
NGLogicalSize replaced_percentage_resolution_size_;
LayoutUnit parent_percentage_resolution_inline_size_;
NGPhysicalSize initial_containing_block_size_;
LayoutUnit fragmentainer_block_size_;
......
......@@ -28,8 +28,6 @@ class CORE_EXPORT NGConstraintSpaceBuilder final {
NGConstraintSpaceBuilder(const NGConstraintSpace& parent_space)
: NGConstraintSpaceBuilder(parent_space.GetWritingMode(),
parent_space.InitialContainingBlockSize()) {
parent_percentage_resolution_size_ =
parent_space.PercentageResolutionSize();
flags_ = NGConstraintSpace::kFixedSizeBlockIsDefinite;
if (parent_space.IsIntermediateLayout())
flags_ |= NGConstraintSpace::kIntermediateLayout;
......@@ -208,7 +206,6 @@ class CORE_EXPORT NGConstraintSpaceBuilder final {
NGLogicalSize percentage_resolution_size_;
NGLogicalSize replaced_percentage_resolution_size_;
base::Optional<NGLogicalSize> parent_percentage_resolution_size_;
NGPhysicalSize initial_containing_block_size_;
LayoutUnit fragmentainer_block_size_ = NGSizeIndefinite;
LayoutUnit fragmentainer_space_at_bfc_start_ = NGSizeIndefinite;
......
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