Commit 8ca2af76 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

Make DetachAbstractInlineTextBoxesIfNeeded public

In preparation to associate |NGFragmentItem| with
|LayoutObject| in <crrev.com/c/2117558>, it needs to call
this function from outside of |LayoutText|.

Bug: 982194
Change-Id: I14a1892d9494ae43748ab4c0145e68e2a21565e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2131175Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755277}
parent 5321cb93
......@@ -278,12 +278,11 @@ void LayoutText::DeleteTextBoxes() {
DetachAbstractInlineTextBoxesIfNeeded();
}
void LayoutText::DetachAbstractInlineTextBoxesIfNeeded() {
void LayoutText::DetachAbstractInlineTextBoxes() {
// TODO(layout-dev): Because We should call |WillDestroy()| once for
// associated fragments, when you reuse fragments, you should construct
// NGAbstractInlineTextBox for them.
if (!has_abstract_inline_text_box_)
return;
DCHECK(has_abstract_inline_text_box_);
has_abstract_inline_text_box_ = false;
if (!RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled()) {
for (NGPaintFragment* fragment : NGPaintFragment::InlineFragmentsFor(this))
......
......@@ -333,6 +333,8 @@ class CORE_EXPORT LayoutText : public LayoutObject {
void InvalidateSubtreeLayoutForFontUpdates() override;
void DetachAbstractInlineTextBoxesIfNeeded();
protected:
void WillBeDestroyed() override;
......@@ -441,7 +443,7 @@ class CORE_EXPORT LayoutText : public LayoutObject {
private:
ContentCaptureManager* GetContentCaptureManager();
void DetachAbstractInlineTextBoxesIfNeeded();
void DetachAbstractInlineTextBoxes();
// Used for LayoutNG with accessibility. True if inline fragments are
// associated to |NGAbstractInlineTextBox|.
......@@ -520,6 +522,11 @@ inline float LayoutText::HyphenWidth(const Font& font,
style, direction));
}
inline void LayoutText::DetachAbstractInlineTextBoxesIfNeeded() {
if (UNLIKELY(has_abstract_inline_text_box_))
DetachAbstractInlineTextBoxes();
}
DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutText, IsText());
inline LayoutText* Text::GetLayoutObject() const {
......
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