Commit 4e4ab263 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[LayoutNG] Remove extra call to AppendIdentityMapping

This patch removes an extra call to AppendIdentityMapping(),
which will later hit DCHECK in ComputeOffsetMappingIfNeeded().

AppendBreakOpportunity() calls Append(), which calls
AppendIdentityMapping(). The caller of AppendBreakOpportunity()
should not call AppendIdentityMapping().

In addition, this patch adds DCHECK to ensure the integrity check
built into ComputeOffsetMappingIfNeeded() always run.

Bug: 636993
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng
Change-Id: Ic7c0ec9d7c8ed8f65475b29bff633ddbeeee3248
Reviewed-on: https://chromium-review.googlesource.com/859817Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#528384}
parent b4c3e808
......@@ -178,7 +178,6 @@ void NGInlineItemsBuilderTemplate<OffsetMappingBuilder>::
if (last_collapsible_space_ == CollapsibleSpace::kSpaceNoWrap &&
IsCollapsibleSpace(string[start]) && style->AutoWrap()) {
AppendBreakOpportunity(style, layout_object);
mapping_builder_.AppendIdentityMapping(1);
start++;
last_collapsible_space_ = CollapsibleSpace::kSpace;
}
......
......@@ -497,6 +497,15 @@ void NGInlineNode::PrepareLayoutIfNeeded() {
DCHECK_EQ(data, MutableData());
block_flow->ClearNeedsCollectInlines();
#if DCHECK_IS_ON()
// ComputeOffsetMappingIfNeeded() runs some integrity checks as part of
// creating offset mapping. Run the check, and discard the result.
DCHECK(!data->offset_mapping_);
ComputeOffsetMappingIfNeeded();
DCHECK(data->offset_mapping_);
data->offset_mapping_.reset();
#endif
}
const NGInlineNodeData& NGInlineNode::EnsureData() {
......
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