Remove BlockRubyWrappingInlineRuby flag The flag has been enabled since M122, and it caused no issues. This CL has no behavior changes. Change-Id: I52c7800e01fe3e10536091fc19d9ea907e7aeb04 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5387146 Commit-Queue: Koji Ishii <kojii@chromium.org> Reviewed-by: Koji Ishii <kojii@chromium.org> Auto-Submit: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/main@{#1276732}
diff --git a/third_party/blink/renderer/core/layout/layout_ruby_as_block.cc b/third_party/blink/renderer/core/layout/layout_ruby_as_block.cc index 47f8941..03aee32 100644 --- a/third_party/blink/renderer/core/layout/layout_ruby_as_block.cc +++ b/third_party/blink/renderer/core/layout/layout_ruby_as_block.cc
@@ -13,98 +13,58 @@ namespace blink { LayoutRubyAsBlock::LayoutRubyAsBlock(Element* element) - : LayoutNGBlockFlow(element), - ruby_container_(MakeGarbageCollected<RubyContainer>(*this)) { + : LayoutNGBlockFlow(element) { UseCounter::Count(GetDocument(), WebFeature::kRenderRuby); } LayoutRubyAsBlock::~LayoutRubyAsBlock() = default; -void LayoutRubyAsBlock::Trace(Visitor* visitor) const { - visitor->Trace(ruby_container_); - LayoutNGBlockFlow::Trace(visitor); -} - void LayoutRubyAsBlock::AddChild(LayoutObject* child, LayoutObject* before_child) { NOT_DESTROYED(); - if (RuntimeEnabledFeatures::BlockRubyWrappingInlineRubyEnabled()) { - LayoutObject* inline_ruby = FirstChild(); - if (!inline_ruby) { - if (RuntimeEnabledFeatures::RubyLineBreakableEnabled()) { - inline_ruby = MakeGarbageCollected<LayoutInline>(nullptr); - } else { - inline_ruby = MakeGarbageCollected<LayoutRuby>(nullptr); - } - inline_ruby->SetDocumentForAnonymous(&GetDocument()); - ComputedStyleBuilder new_style_builder = - GetDocument() - .GetStyleResolver() - .CreateAnonymousStyleBuilderWithDisplay(StyleRef(), - EDisplay::kRuby); - inline_ruby->SetStyle(new_style_builder.TakeStyle()); - LayoutNGBlockFlow::AddChild(inline_ruby); + LayoutObject* inline_ruby = FirstChild(); + if (!inline_ruby) { + if (RuntimeEnabledFeatures::RubyLineBreakableEnabled()) { + inline_ruby = MakeGarbageCollected<LayoutInline>(nullptr); + } else { + inline_ruby = MakeGarbageCollected<LayoutRuby>(nullptr); } - inline_ruby->AddChild(child, before_child); - return; + inline_ruby->SetDocumentForAnonymous(&GetDocument()); + ComputedStyleBuilder new_style_builder = + GetDocument().GetStyleResolver().CreateAnonymousStyleBuilderWithDisplay( + StyleRef(), EDisplay::kRuby); + inline_ruby->SetStyle(new_style_builder.TakeStyle()); + LayoutNGBlockFlow::AddChild(inline_ruby); } - - // If the child is a ruby column, just add it normally. - if (child->IsRubyColumn()) { - LayoutNGBlockFlow::AddChild(child, before_child); - return; - } - - ruby_container_->AddChild(child, before_child); + inline_ruby->AddChild(child, before_child); } void LayoutRubyAsBlock::RemoveChild(LayoutObject* child) { NOT_DESTROYED(); - if (RuntimeEnabledFeatures::BlockRubyWrappingInlineRubyEnabled()) { - if (child->Parent() == this) { - DCHECK(DynamicTo<LayoutRuby>(child)); - LayoutNGBlockFlow::RemoveChild(child); - return; - } - NOTREACHED() << child; - return; - } - - // If the child's parent is *this (must be a ruby column), just use the normal - // remove method. if (child->Parent() == this) { - DCHECK(child->IsRubyColumn()); + DCHECK(DynamicTo<LayoutRuby>(child)); LayoutNGBlockFlow::RemoveChild(child); return; } - NOTREACHED() << child; } -void LayoutRubyAsBlock::DidRemoveChildFromColumn(LayoutObject& child) { - DCHECK(!RuntimeEnabledFeatures::BlockRubyWrappingInlineRubyEnabled()); - ruby_container_->DidRemoveChildFromColumn(child); -} - void LayoutRubyAsBlock::StyleDidChange(StyleDifference diff, const ComputedStyle* old_style) { NOT_DESTROYED(); LayoutNGBlockFlow::StyleDidChange(diff, old_style); PropagateStyleToAnonymousChildren(); - if (RuntimeEnabledFeatures::BlockRubyWrappingInlineRubyEnabled()) { - // Because LayoutInline::AnonymousHasStylePropagationOverride() returns - // true, PropagateStyleToAnonymousChildren() doesn't update the style of - // the LayoutRuby child. - if (auto* inline_ruby = FirstChild()) { - ComputedStyleBuilder new_style_builder = - GetDocument() - .GetStyleResolver() - .CreateAnonymousStyleBuilderWithDisplay( - StyleRef(), inline_ruby->StyleRef().Display()); - UpdateAnonymousChildStyle(inline_ruby, new_style_builder); - inline_ruby->SetStyle(new_style_builder.TakeStyle()); - } + + // Because LayoutInline::AnonymousHasStylePropagationOverride() returns + // true, PropagateStyleToAnonymousChildren() doesn't update the style of + // the LayoutRuby child. + if (auto* inline_ruby = FirstChild()) { + ComputedStyleBuilder new_style_builder = + GetDocument().GetStyleResolver().CreateAnonymousStyleBuilderWithDisplay( + StyleRef(), inline_ruby->StyleRef().Display()); + UpdateAnonymousChildStyle(inline_ruby, new_style_builder); + inline_ruby->SetStyle(new_style_builder.TakeStyle()); } }
diff --git a/third_party/blink/renderer/core/layout/layout_ruby_as_block.h b/third_party/blink/renderer/core/layout/layout_ruby_as_block.h index a62f9c28..fec4ab0 100644 --- a/third_party/blink/renderer/core/layout/layout_ruby_as_block.h +++ b/third_party/blink/renderer/core/layout/layout_ruby_as_block.h
@@ -10,8 +10,6 @@ namespace blink { -class RubyContainer; - // This is a general block container wrapping an anonymous LayoutRuby. // // https://drafts.csswg.org/css-ruby/#block-ruby @@ -22,7 +20,6 @@ public: explicit LayoutRubyAsBlock(Element*); ~LayoutRubyAsBlock() override; - void Trace(Visitor* visitor) const override; const char* GetName() const override { NOT_DESTROYED(); @@ -38,11 +35,6 @@ void RemoveChild(LayoutObject* child) override; void StyleDidChange(StyleDifference, const ComputedStyle* old_style) override; void RemoveLeftoverAnonymousBlock(LayoutBlock*) override; - - void DidRemoveChildFromColumn(LayoutObject& child); - - private: - Member<RubyContainer> ruby_container_; }; template <>
diff --git a/third_party/blink/renderer/core/layout/layout_ruby_column.cc b/third_party/blink/renderer/core/layout/layout_ruby_column.cc index a16fba2..0a3778a 100644 --- a/third_party/blink/renderer/core/layout/layout_ruby_column.cc +++ b/third_party/blink/renderer/core/layout/layout_ruby_column.cc
@@ -6,7 +6,6 @@ #include "third_party/blink/renderer/core/css/resolver/style_resolver.h" #include "third_party/blink/renderer/core/layout/layout_ruby.h" -#include "third_party/blink/renderer/core/layout/layout_ruby_as_block.h" #include "third_party/blink/renderer/core/layout/layout_ruby_base.h" #include "third_party/blink/renderer/core/layout/layout_ruby_text.h" @@ -114,8 +113,6 @@ DCHECK(child->IsRubyBase() || child->IsRubyText()); if (auto* inline_ruby = DynamicTo<LayoutRuby>(Parent())) { inline_ruby->DidRemoveChildFromColumn(*child); - } else { - To<LayoutRubyAsBlock>(Parent())->DidRemoveChildFromColumn(*child); } // Do nothing here! `this` might be destroyed by RubyContainer::Repair(). }
diff --git a/third_party/blink/renderer/core/layout/ruby_container.h b/third_party/blink/renderer/core/layout/ruby_container.h index 9b84fe6a..99b4ab3 100644 --- a/third_party/blink/renderer/core/layout/ruby_container.h +++ b/third_party/blink/renderer/core/layout/ruby_container.h
@@ -14,7 +14,7 @@ class LayoutBoxModelObject; class LayoutObject; -// RubyContainer is a common part of LayoutRubyAsInline and LayoutRubyAsBlock. +// RubyContainer is a helper for LayoutRuby. class RubyContainer : public GarbageCollected<RubyContainer> { public: explicit RubyContainer(LayoutBoxModelObject& ruby);
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index f19d9fb..c1eb7df57 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -490,10 +490,6 @@ name: "BlockingFocusWithoutUserActivation", status: "experimental", }, - { - name: "BlockRubyWrappingInlineRuby", - status: "stable", - }, // crbug.com/1147998: Mouse and Pointer boundary event dispatch (i.e. dispatch // of enter, leave, over, out events) tracks DOM node removal to fix event // pairing on ancestor nodes.