Commit 3fc8ab94 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

RubyNG: Introduce LayoutNGRubyText

This CL has no behavior changes because changes are behind a
runtime flag.

After this CL, fast/ruby/ tests won't crash with LayoutNGRuby flag.

Bug: 1069817
Change-Id: Ie9c1f3ce05e9e09838f8bf7c7c07e0288bdfa466
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2152132Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759911}
parent e39eb184
...@@ -6,17 +6,26 @@ ...@@ -6,17 +6,26 @@
#include "third_party/blink/renderer/core/html_names.h" #include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/layout/layout_ruby_text.h" #include "third_party/blink/renderer/core/layout/layout_ruby_text.h"
#include "third_party/blink/renderer/core/layout/ng/layout_ng_ruby_text.h"
namespace blink { namespace blink {
HTMLRTElement::HTMLRTElement(Document& document) HTMLRTElement::HTMLRTElement(Document& document)
: HTMLElement(html_names::kRtTag, document) {} : HTMLElement(html_names::kRtTag, document) {}
bool HTMLRTElement::TypeShouldForceLegacyLayout() const {
return !RuntimeEnabledFeatures::LayoutNGRubyEnabled();
}
LayoutObject* HTMLRTElement::CreateLayoutObject(const ComputedStyle& style, LayoutObject* HTMLRTElement::CreateLayoutObject(const ComputedStyle& style,
LegacyLayout legacy) { LegacyLayout legacy) {
if (style.Display() == EDisplay::kBlock) { if (style.Display() == EDisplay::kBlock) {
UseCounter::Count(GetDocument(), WebFeature::kLegacyLayoutByRuby); if (!RuntimeEnabledFeatures::LayoutNGRubyEnabled() ||
return new LayoutRubyText(this); legacy == LegacyLayout::kForce) {
UseCounter::Count(GetDocument(), WebFeature::kLegacyLayoutByRuby);
return new LayoutRubyText(this);
}
return new LayoutNGRubyText(this);
} }
return LayoutObject::CreateObject(this, style, legacy); return LayoutObject::CreateObject(this, style, legacy);
} }
......
...@@ -17,7 +17,7 @@ class HTMLRTElement final : public HTMLElement { ...@@ -17,7 +17,7 @@ class HTMLRTElement final : public HTMLElement {
private: private:
LayoutObject* CreateLayoutObject(const ComputedStyle&, LegacyLayout) override; LayoutObject* CreateLayoutObject(const ComputedStyle&, LegacyLayout) override;
bool TypeShouldForceLegacyLayout() const final { return true; } bool TypeShouldForceLegacyLayout() const final;
}; };
} // namespace blink } // namespace blink
......
...@@ -408,6 +408,8 @@ blink_core_sources("layout") { ...@@ -408,6 +408,8 @@ blink_core_sources("layout") {
"ng/layout_ng_ruby_base.h", "ng/layout_ng_ruby_base.h",
"ng/layout_ng_ruby_run.cc", "ng/layout_ng_ruby_run.cc",
"ng/layout_ng_ruby_run.h", "ng/layout_ng_ruby_run.h",
"ng/layout_ng_ruby_text.cc",
"ng/layout_ng_ruby_text.h",
"ng/layout_ng_table_caption.cc", "ng/layout_ng_table_caption.cc",
"ng/layout_ng_table_caption.h", "ng/layout_ng_table_caption.h",
"ng/layout_ng_table_cell.cc", "ng/layout_ng_table_cell.cc",
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
namespace blink { namespace blink {
class LayoutRubyText final : public LayoutBlockFlow { class LayoutRubyText : public LayoutBlockFlow {
public: public:
LayoutRubyText(Element*); LayoutRubyText(Element*);
~LayoutRubyText() override; ~LayoutRubyText() override;
......
...@@ -344,6 +344,7 @@ template class CORE_TEMPLATE_EXPORT LayoutNGBlockFlowMixin<LayoutProgress>; ...@@ -344,6 +344,7 @@ template class CORE_TEMPLATE_EXPORT LayoutNGBlockFlowMixin<LayoutProgress>;
template class CORE_TEMPLATE_EXPORT LayoutNGBlockFlowMixin<LayoutRubyAsBlock>; template class CORE_TEMPLATE_EXPORT LayoutNGBlockFlowMixin<LayoutRubyAsBlock>;
template class CORE_TEMPLATE_EXPORT LayoutNGBlockFlowMixin<LayoutRubyBase>; template class CORE_TEMPLATE_EXPORT LayoutNGBlockFlowMixin<LayoutRubyBase>;
template class CORE_TEMPLATE_EXPORT LayoutNGBlockFlowMixin<LayoutRubyRun>; template class CORE_TEMPLATE_EXPORT LayoutNGBlockFlowMixin<LayoutRubyRun>;
template class CORE_TEMPLATE_EXPORT LayoutNGBlockFlowMixin<LayoutRubyText>;
template class CORE_TEMPLATE_EXPORT LayoutNGBlockFlowMixin<LayoutTableCaption>; template class CORE_TEMPLATE_EXPORT LayoutNGBlockFlowMixin<LayoutTableCaption>;
template class CORE_TEMPLATE_EXPORT LayoutNGBlockFlowMixin<LayoutTableCell>; template class CORE_TEMPLATE_EXPORT LayoutNGBlockFlowMixin<LayoutTableCell>;
......
...@@ -104,6 +104,8 @@ extern template class CORE_EXTERN_TEMPLATE_EXPORT ...@@ -104,6 +104,8 @@ extern template class CORE_EXTERN_TEMPLATE_EXPORT
LayoutNGBlockFlowMixin<LayoutRubyBase>; LayoutNGBlockFlowMixin<LayoutRubyBase>;
extern template class CORE_EXTERN_TEMPLATE_EXPORT extern template class CORE_EXTERN_TEMPLATE_EXPORT
LayoutNGBlockFlowMixin<LayoutRubyRun>; LayoutNGBlockFlowMixin<LayoutRubyRun>;
extern template class CORE_EXTERN_TEMPLATE_EXPORT
LayoutNGBlockFlowMixin<LayoutRubyText>;
extern template class CORE_EXTERN_TEMPLATE_EXPORT extern template class CORE_EXTERN_TEMPLATE_EXPORT
LayoutNGBlockFlowMixin<LayoutTableCaption>; LayoutNGBlockFlowMixin<LayoutTableCaption>;
extern template class CORE_EXTERN_TEMPLATE_EXPORT extern template class CORE_EXTERN_TEMPLATE_EXPORT
......
...@@ -281,6 +281,7 @@ template class CORE_TEMPLATE_EXPORT LayoutNGMixin<LayoutProgress>; ...@@ -281,6 +281,7 @@ template class CORE_TEMPLATE_EXPORT LayoutNGMixin<LayoutProgress>;
template class CORE_TEMPLATE_EXPORT LayoutNGMixin<LayoutRubyAsBlock>; template class CORE_TEMPLATE_EXPORT LayoutNGMixin<LayoutRubyAsBlock>;
template class CORE_TEMPLATE_EXPORT LayoutNGMixin<LayoutRubyBase>; template class CORE_TEMPLATE_EXPORT LayoutNGMixin<LayoutRubyBase>;
template class CORE_TEMPLATE_EXPORT LayoutNGMixin<LayoutRubyRun>; template class CORE_TEMPLATE_EXPORT LayoutNGMixin<LayoutRubyRun>;
template class CORE_TEMPLATE_EXPORT LayoutNGMixin<LayoutRubyText>;
template class CORE_TEMPLATE_EXPORT LayoutNGMixin<LayoutTableCaption>; template class CORE_TEMPLATE_EXPORT LayoutNGMixin<LayoutTableCaption>;
template class CORE_TEMPLATE_EXPORT LayoutNGMixin<LayoutTableCell>; template class CORE_TEMPLATE_EXPORT LayoutNGMixin<LayoutTableCell>;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "third_party/blink/renderer/core/layout/layout_ruby.h" #include "third_party/blink/renderer/core/layout/layout_ruby.h"
#include "third_party/blink/renderer/core/layout/layout_ruby_base.h" #include "third_party/blink/renderer/core/layout/layout_ruby_base.h"
#include "third_party/blink/renderer/core/layout/layout_ruby_run.h" #include "third_party/blink/renderer/core/layout/layout_ruby_run.h"
#include "third_party/blink/renderer/core/layout/layout_ruby_text.h"
#include "third_party/blink/renderer/core/layout/layout_table_caption.h" #include "third_party/blink/renderer/core/layout/layout_table_caption.h"
#include "third_party/blink/renderer/core/layout/layout_table_cell.h" #include "third_party/blink/renderer/core/layout/layout_table_cell.h"
...@@ -55,6 +56,7 @@ extern template class CORE_EXTERN_TEMPLATE_EXPORT ...@@ -55,6 +56,7 @@ extern template class CORE_EXTERN_TEMPLATE_EXPORT
LayoutNGMixin<LayoutRubyAsBlock>; LayoutNGMixin<LayoutRubyAsBlock>;
extern template class CORE_EXTERN_TEMPLATE_EXPORT LayoutNGMixin<LayoutRubyBase>; extern template class CORE_EXTERN_TEMPLATE_EXPORT LayoutNGMixin<LayoutRubyBase>;
extern template class CORE_EXTERN_TEMPLATE_EXPORT LayoutNGMixin<LayoutRubyRun>; extern template class CORE_EXTERN_TEMPLATE_EXPORT LayoutNGMixin<LayoutRubyRun>;
extern template class CORE_EXTERN_TEMPLATE_EXPORT LayoutNGMixin<LayoutRubyText>;
extern template class CORE_EXTERN_TEMPLATE_EXPORT extern template class CORE_EXTERN_TEMPLATE_EXPORT
LayoutNGMixin<LayoutTableCaption>; LayoutNGMixin<LayoutTableCaption>;
extern template class CORE_EXTERN_TEMPLATE_EXPORT extern template class CORE_EXTERN_TEMPLATE_EXPORT
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/layout/ng/layout_ng_ruby_text.h"
namespace blink {
LayoutNGRubyText::LayoutNGRubyText(Element* element)
: LayoutNGBlockFlowMixin<LayoutRubyText>(element) {}
LayoutNGRubyText::~LayoutNGRubyText() = default;
void LayoutNGRubyText::UpdateBlockLayout(bool relayout_children) {
UpdateNGBlockLayout();
}
} // namespace blink
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_LAYOUT_NG_RUBY_TEXT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_LAYOUT_NG_RUBY_TEXT_H_
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/layout/layout_ruby_text.h"
#include "third_party/blink/renderer/core/layout/ng/layout_ng_block_flow_mixin.h"
namespace blink {
// A LayoutNG version of LayoutRubyText.
class CORE_EXPORT LayoutNGRubyText final
: public LayoutNGBlockFlowMixin<LayoutRubyText> {
public:
explicit LayoutNGRubyText(Element* element);
~LayoutNGRubyText() override;
const char* GetName() const override { return "LayoutNGRubyText"; }
void UpdateBlockLayout(bool relayout_children) override;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_LAYOUT_NG_RUBY_TEXT_H_
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