Commit 6c7007af authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Make NGInlineItemsBuilderTempalte not to use BoxInfo for offset mapping


Because of offset mapping doesn't use |BoxInfo| and creating |BoxInfo| also
causes side-effect to mark layout objects |InNGInlineFormattingContext| this
patch changes |NGInlineItemsBuilderTempalte<T>| not to use |BoxInfo| for
offset mapping.

This patch is follow-up the patch[1] and preparation of the patch[2].

[1] http://crrev.com/c/1327582 Make NGOffsetMapping available for non-LayoutNG
LayoutBlockFlow
[2] http://crrev.com/c/1337224 Utilize NGInlineNode::GetOffsetMapping() in
Element#innerText

Change-Id: Id5a9d9c4e998261cfa57ec24fc9e268b002a8617
Reviewed-on: https://chromium-review.googlesource.com/c/1341293
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609193}
parent eb625ae7
......@@ -4,6 +4,8 @@
#include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_items_builder.h"
#include <type_traits>
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/layout/layout_text.h"
#include "third_party/blink/renderer/core/layout/ng/inline/layout_ng_text.h"
......@@ -13,6 +15,12 @@
namespace blink {
// Returns true if items builder is used for other than offset mapping.
template <typename OffsetMappingBuilder>
bool NGInlineItemsBuilderTemplate<OffsetMappingBuilder>::NeedsBoxInfo() {
return !std::is_same<NGOffsetMappingBuilder, OffsetMappingBuilder>::value;
}
template <typename OffsetMappingBuilder>
NGInlineItemsBuilderTemplate<
OffsetMappingBuilder>::~NGInlineItemsBuilderTemplate() {
......@@ -936,6 +944,9 @@ void NGInlineItemsBuilderTemplate<OffsetMappingBuilder>::EnterInline(
AppendOpaque(NGInlineItem::kOpenTag, style, node);
if (!NeedsBoxInfo())
return;
// Set |ShouldCreateBoxFragment| of the parent box if needed.
BoxInfo* current_box =
&boxes_.emplace_back(items_->size() - 1, items_->back());
......@@ -965,7 +976,8 @@ void NGInlineItemsBuilderTemplate<OffsetMappingBuilder>::ExitInline(
AppendOpaque(NGInlineItem::kCloseTag, node->Style(), node);
boxes_.pop_back();
if (NeedsBoxInfo())
boxes_.pop_back();
Exit(node);
......
......@@ -111,6 +111,8 @@ class NGInlineItemsBuilderTemplate {
void SetIsSymbolMarker(bool b);
private:
static bool NeedsBoxInfo();
Vector<NGInlineItem>* items_;
StringBuilder text_;
......
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