Commit 92504065 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

[EditingNG] Temporary enable NGInlineNodeDataEditor::VerifyItems()

This patch enables |NGInlineNodeDataEditor::VerifyItems()| to verify offsets in
|ShapeResult| to identify reproduce steps.

Bug: 1121885
Change-Id: I1fb1e423c134f3228cee3487e5af5ae86745437b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2376933
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Auto-Submit: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801710}
parent e4fc539e
......@@ -715,26 +715,26 @@ class NGInlineNodeDataEditor final {
item->shape_result_->CopyAdjustedOffset(item->start_offset_);
}
// TODO(yosin): Once we can reproduce invalid |ShapeResult| offsets, we
// should make this function works only for |DCHECK_IS_ON()|.
void VerifyItems(const Vector<NGInlineItem>& items) const {
#if DCHECK_IS_ON()
unsigned last_offset = items.front().start_offset_;
for (const NGInlineItem& item : items) {
DCHECK_LE(item.start_offset_, item.end_offset_);
DCHECK_EQ(last_offset, item.start_offset_);
CHECK_LE(item.start_offset_, item.end_offset_);
CHECK_EQ(last_offset, item.start_offset_);
last_offset = item.end_offset_;
if (!item.shape_result_ || item.layout_object_ != layout_text_)
continue;
DCHECK_LT(item.start_offset_, item.end_offset_);
CHECK_LT(item.start_offset_, item.end_offset_);
if (item.shape_result_->StartIndex() == item.start_offset_) {
DCHECK_LE(item.shape_result_->EndIndex(), item.end_offset_);
CHECK_LE(item.shape_result_->EndIndex(), item.end_offset_);
} else {
DCHECK_LE(item.start_offset_, item.shape_result_->StartIndex());
DCHECK_EQ(item.end_offset_, item.shape_result_->EndIndex());
CHECK_LE(item.start_offset_, item.shape_result_->StartIndex());
CHECK_EQ(item.end_offset_, item.shape_result_->EndIndex());
}
}
DCHECK_EQ(last_offset,
block_flow_->GetNGInlineNodeData()->text_content.length());
#endif
CHECK_EQ(last_offset,
block_flow_->GetNGInlineNodeData()->text_content.length());
}
std::unique_ptr<NGInlineNodeData> data_;
......
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