Skip to content

Commit

Permalink
Remove LayoutNGFieldset runtime flag
Browse files Browse the repository at this point in the history
The flag has been enabled since M86, and we have never seen regression
issues recently.

This CL has no behavior changes.

Change-Id: I886c8c0263667fb60c960981a1c36a67d06cba53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2711745
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Auto-Submit: Kent Tamura <tkent@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#857006}
  • Loading branch information
tkent-google authored and Chromium LUCI CQ committed Feb 24, 2021
1 parent 11ed025 commit 6d562b2
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2535,7 +2535,6 @@ enum WebFeature {
kLegacyLayoutByDeprecatedFlexBox = 3205,
kLegacyLayoutByDetailsMarker = 3206,
kLegacyLayoutByEditing = 3207,
kLegacyLayoutByFieldSet = 3208,
kLegacyLayoutByFlexBox = 3210,
kLegacyLayoutByFrameSet = 3211,
kLegacyLayoutByGrid = 3212,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ LayoutBox* HTMLFieldSetElement::GetLayoutBoxForScrolling() const {
return HTMLFormControlElement::GetLayoutBoxForScrolling();
}

bool HTMLFieldSetElement::TypeShouldForceLegacyLayout() const {
return !RuntimeEnabledFeatures::LayoutNGFieldsetEnabled();
}

HTMLLegendElement* HTMLFieldSetElement::Legend() const {
return Traversal<HTMLLegendElement>::FirstChild(*this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class CORE_EXPORT HTMLFieldSetElement final : public HTMLFormControlElement {
bool SupportsFocus() const override;
LayoutObject* CreateLayoutObject(const ComputedStyle&, LegacyLayout) override;
LayoutBox* GetLayoutBoxForScrolling() const override;
bool TypeShouldForceLegacyLayout() const final;
const AtomicString& FormControlType() const override;
bool RecalcWillValidate() const override { return false; }
bool MatchesValidityPseudoClasses() const final;
Expand Down
4 changes: 1 addition & 3 deletions third_party/blink/renderer/core/layout/layout_block.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1064,9 +1064,7 @@ void LayoutBlock::RemovePositionedObject(LayoutBox* o) {

bool LayoutBlock::IsAnonymousNGFieldsetContentWrapper() const {
NOT_DESTROYED();
if (!RuntimeEnabledFeatures::LayoutNGFieldsetEnabled() || !Parent())
return false;
return Parent()->IsLayoutNGFieldset();
return Parent() && Parent()->IsLayoutNGFieldset();
}

void LayoutBlock::InvalidatePaint(
Expand Down
22 changes: 10 additions & 12 deletions third_party/blink/renderer/core/layout/layout_fieldset.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,16 @@ LayoutObject* LayoutFieldset::LayoutSpecialExcludedChild(bool relayout_children,
LayoutBox* LayoutFieldset::FindInFlowLegend(const LayoutBlock& fieldset) {
DCHECK(fieldset.IsFieldset() || fieldset.IsLayoutNGFieldset());
const LayoutBlock* parent = &fieldset;
if (RuntimeEnabledFeatures::LayoutNGFieldsetEnabled()) {
if (fieldset.IsLayoutNGFieldset()) {
// If there is a rendered legend, it will be found inside the anonymous
// fieldset wrapper.
parent = To<LayoutBlock>(fieldset.FirstChild());
if (!parent)
return nullptr;
// If the anonymous fieldset wrapper is a multi-column, the rendered
// legend will be found inside the multi-column flow thread.
if (parent->FirstChild() && parent->FirstChild()->IsLayoutFlowThread())
parent = To<LayoutBlock>(parent->FirstChild());
}
if (fieldset.IsLayoutNGFieldset()) {
// If there is a rendered legend, it will be found inside the anonymous
// fieldset wrapper.
parent = To<LayoutBlock>(fieldset.FirstChild());
if (!parent)
return nullptr;
// If the anonymous fieldset wrapper is a multi-column, the rendered
// legend will be found inside the multi-column flow thread.
if (parent->FirstChild() && parent->FirstChild()->IsLayoutFlowThread())
parent = To<LayoutBlock>(parent->FirstChild());
}
for (LayoutObject* legend = parent->FirstChild(); legend;
legend = legend->NextSibling()) {
Expand Down
18 changes: 9 additions & 9 deletions third_party/blink/renderer/core/layout/layout_object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -610,15 +610,15 @@ bool LayoutObject::IsRenderedLegendInternal() const {
// We may not be inserted into the tree yet.
if (!parent)
return false;
if (RuntimeEnabledFeatures::LayoutNGFieldsetEnabled()) {
// If there is a rendered legend, it will be found inside the anonymous
// fieldset wrapper. If the anonymous fieldset wrapper is a multi-column,
// the rendered legend will be found inside the multi-column flow thread.
if (parent->IsLayoutFlowThread())
parent = parent->Parent();
if (parent->IsAnonymous() && parent->Parent()->IsLayoutNGFieldset())
parent = parent->Parent();
}

// If there is a rendered legend, it will be found inside the anonymous
// fieldset wrapper. If the anonymous fieldset wrapper is a multi-column,
// the rendered legend will be found inside the multi-column flow thread.
if (parent->IsLayoutFlowThread())
parent = parent->Parent();
if (parent->IsAnonymous() && parent->Parent()->IsLayoutNGFieldset())
parent = parent->Parent();

const auto* parent_layout_block = DynamicTo<LayoutBlock>(parent);
return parent_layout_block && IsA<HTMLFieldSetElement>(parent->GetNode()) &&
LayoutFieldset::FindInFlowLegend(*parent_layout_block) == this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,8 @@ LayoutObject* LayoutObjectFactory::CreateButton(Node& node,
LayoutBlock* LayoutObjectFactory::CreateFieldset(Node& node,
const ComputedStyle& style,
LegacyLayout legacy) {
bool disable_ng_for_type = !RuntimeEnabledFeatures::LayoutNGFieldsetEnabled();
if (disable_ng_for_type)
UseCounter::Count(node.GetDocument(), WebFeature::kLegacyLayoutByFieldSet);
return CreateObject<LayoutBlock, LayoutNGFieldset, LayoutFieldset>(
node, style, legacy, disable_ng_for_type);
node, style, legacy);
}

LayoutBlockFlow* LayoutObjectFactory::CreateFileUploadControl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ namespace {

class NGFieldsetLayoutAlgorithmTest
: public NGBaseLayoutAlgorithmTest,
private ScopedLayoutNGFieldsetForTest,
private ScopedLayoutNGBlockFragmentationForTest {
protected:
NGFieldsetLayoutAlgorithmTest()
: ScopedLayoutNGFieldsetForTest(true),
ScopedLayoutNGBlockFragmentationForTest(true) {}
: ScopedLayoutNGBlockFragmentationForTest(true) {}

scoped_refptr<const NGPhysicalBoxFragment> RunBlockLayoutAlgorithm(
Element* element) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1140,11 +1140,6 @@
name: "LayoutNGBlockFragmentation",
implied_by: ["LayoutNGPrinting"],
},
{
name: "LayoutNGFieldset",
depends_on: ["LayoutNG"],
status: "stable",
},
{
// Traverse the fragment tree when painting and hit-testing, instead of
// the layout object tree.
Expand Down
2 changes: 1 addition & 1 deletion tools/metrics/histograms/enums.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30961,7 +30961,7 @@ Called by update_use_counter_feature_enum.py.-->
<int value="3205" label="LegacyLayoutByDeprecatedFlexBox"/>
<int value="3206" label="LegacyLayoutByDetailsMarker"/>
<int value="3207" label="LegacyLayoutByEditing"/>
<int value="3208" label="LegacyLayoutByFieldSet"/>
<int value="3208" label="OBSOLETE_LegacyLayoutByFieldSet"/>
<int value="3209" label="OBSOLETE_LegacyLayoutByFileUploadControl"/>
<int value="3210" label="LegacyLayoutByFlexBox"/>
<int value="3211" label="LegacyLayoutByFrameSet"/>
Expand Down

0 comments on commit 6d562b2

Please sign in to comment.