Commit 6dbee795 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

LayoutNG for buttons: Remove IsLayoutButton(), and add IsButtonOrNGButton()

This CL removes LayoutObject::IsLayoutButton(), which check if |this| is
a LayoutButton, and adds LayoutObject::IsButtonOrNGButton(), which check
if |this| is a LayoutButton or a LayoutNGButton. Also, this replaces
existing callsites of IsLayoutButton() with IsButtonOrNGButton().

This CL has no behavior changes because LayoutNGButton is no used yet.

Bug: 1040826
Change-Id: I92f052d50a6467ea2d1c86c4e75d3d68db8a75cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2302975
Commit-Queue: Kent Tamura <tkent@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Auto-Submit: Kent Tamura <tkent@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789343}
parent ee8f5180
......@@ -164,7 +164,7 @@ LayoutText* FirstLetterPseudoElement::FirstLetterTextLayoutObject(
first_letter_text_layout_object =
first_letter_text_layout_object->NextSibling();
} else if (first_letter_text_layout_object->IsAtomicInlineLevel() ||
first_letter_text_layout_object->IsLayoutButton() ||
first_letter_text_layout_object->IsButtonOrNGButton() ||
IsMenuList(first_letter_text_layout_object)) {
return nullptr;
} else if (first_letter_text_layout_object
......
......@@ -254,7 +254,7 @@ static inline bool CanHaveWhitespaceChildren(
const LayoutObject& parent = *context.parent;
// <button> and <fieldset> should allow whitespace even though
// LayoutFlexibleBox doesn't.
if (parent.IsLayoutButton() || parent.IsFieldset())
if (parent.IsButtonOrNGButton() || parent.IsFieldset())
return true;
if (parent.IsTable() || parent.IsTableRow() || parent.IsTableSection() ||
......
......@@ -24,7 +24,7 @@ static bool CanHaveGeneratedChildren(const LayoutObject& layout_object) {
// Input elements can't have generated children, but button elements can.
// We'll write the code assuming any other button types that might emerge in
// the future can also have children.
if (layout_object.IsLayoutButton())
if (layout_object.IsButtonOrNGButton())
return !IsA<HTMLInputElement>(*layout_object.GetNode());
return layout_object.CanHaveChildren();
......
......@@ -2238,7 +2238,7 @@ PhysicalRect LayoutBox::OverflowClipRect(
if (UNLIKELY(input)) {
// As for LayoutButton, ControlClip is to for not BUTTONs but INPUT
// buttons for IE/Firefox compatibility.
if (IsTextField() || IsLayoutButton()) {
if (IsTextField() || IsButtonOrNGButton()) {
DCHECK(HasControlClip());
PhysicalRect control_clip = PhysicalPaddingBoxRect();
control_clip.Move(location);
......@@ -2258,7 +2258,7 @@ PhysicalRect LayoutBox::OverflowClipRect(
bool LayoutBox::HasControlClip() const {
return UNLIKELY(IsTextField() || IsFileUploadControl() || IsMenuList(this) ||
(IsLayoutButton() && IsA<HTMLInputElement>(GetNode())));
(IsButtonOrNGButton() && IsA<HTMLInputElement>(GetNode())));
}
void LayoutBox::ExcludeScrollbars(
......
......@@ -716,7 +716,10 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
}
bool IsProgress() const { return IsOfType(kLayoutObjectProgress); }
bool IsQuote() const { return IsOfType(kLayoutObjectQuote); }
bool IsLayoutButton() const { return IsOfType(kLayoutObjectLayoutButton); }
bool IsButtonOrNGButton() const {
return IsOfType(kLayoutObjectLayoutButton) ||
IsOfType(kLayoutObjectNGButton);
}
bool IsLayoutNGButton() const { return IsOfType(kLayoutObjectNGButton); }
bool IsLayoutNGCustom() const {
return IsOfType(kLayoutObjectLayoutNGCustom);
......@@ -1293,7 +1296,7 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
SpannerPlaceholder();
}
// We include isLayoutButton() in this check, because buttons are
// We include IsButtonOrNGButton() in this check, because buttons are
// implemented using flex box but should still support things like
// first-line, first-letter and text-overflow.
// The flex box and grid specs require that flex box and grid do not
......@@ -1304,7 +1307,7 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
// instead of flex box. crbug.com/226252.
bool BehavesLikeBlockContainer() const {
return (IsLayoutBlockFlow() && StyleRef().IsDisplayBlockContainer()) ||
IsLayoutButton();
IsButtonOrNGButton();
}
// May be optionally passed to container() and various other similar methods
......
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