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() { ...@@ -278,12 +278,11 @@ void LayoutText::DeleteTextBoxes() {
DetachAbstractInlineTextBoxesIfNeeded(); DetachAbstractInlineTextBoxesIfNeeded();
} }
void LayoutText::DetachAbstractInlineTextBoxesIfNeeded() { void LayoutText::DetachAbstractInlineTextBoxes() {
// TODO(layout-dev): Because We should call |WillDestroy()| once for // TODO(layout-dev): Because We should call |WillDestroy()| once for
// associated fragments, when you reuse fragments, you should construct // associated fragments, when you reuse fragments, you should construct
// NGAbstractInlineTextBox for them. // NGAbstractInlineTextBox for them.
if (!has_abstract_inline_text_box_) DCHECK(has_abstract_inline_text_box_);
return;
has_abstract_inline_text_box_ = false; has_abstract_inline_text_box_ = false;
if (!RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled()) { if (!RuntimeEnabledFeatures::LayoutNGFragmentItemEnabled()) {
for (NGPaintFragment* fragment : NGPaintFragment::InlineFragmentsFor(this)) for (NGPaintFragment* fragment : NGPaintFragment::InlineFragmentsFor(this))
......
...@@ -333,6 +333,8 @@ class CORE_EXPORT LayoutText : public LayoutObject { ...@@ -333,6 +333,8 @@ class CORE_EXPORT LayoutText : public LayoutObject {
void InvalidateSubtreeLayoutForFontUpdates() override; void InvalidateSubtreeLayoutForFontUpdates() override;
void DetachAbstractInlineTextBoxesIfNeeded();
protected: protected:
void WillBeDestroyed() override; void WillBeDestroyed() override;
...@@ -441,7 +443,7 @@ class CORE_EXPORT LayoutText : public LayoutObject { ...@@ -441,7 +443,7 @@ class CORE_EXPORT LayoutText : public LayoutObject {
private: private:
ContentCaptureManager* GetContentCaptureManager(); ContentCaptureManager* GetContentCaptureManager();
void DetachAbstractInlineTextBoxesIfNeeded(); void DetachAbstractInlineTextBoxes();
// Used for LayoutNG with accessibility. True if inline fragments are // Used for LayoutNG with accessibility. True if inline fragments are
// associated to |NGAbstractInlineTextBox|. // associated to |NGAbstractInlineTextBox|.
...@@ -520,6 +522,11 @@ inline float LayoutText::HyphenWidth(const Font& font, ...@@ -520,6 +522,11 @@ inline float LayoutText::HyphenWidth(const Font& font,
style, direction)); style, direction));
} }
inline void LayoutText::DetachAbstractInlineTextBoxesIfNeeded() {
if (UNLIKELY(has_abstract_inline_text_box_))
DetachAbstractInlineTextBoxes();
}
DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutText, IsText()); DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutText, IsText());
inline LayoutText* Text::GetLayoutObject() const { 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