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( ...@@ -164,7 +164,7 @@ LayoutText* FirstLetterPseudoElement::FirstLetterTextLayoutObject(
first_letter_text_layout_object = first_letter_text_layout_object =
first_letter_text_layout_object->NextSibling(); first_letter_text_layout_object->NextSibling();
} else if (first_letter_text_layout_object->IsAtomicInlineLevel() || } 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)) { IsMenuList(first_letter_text_layout_object)) {
return nullptr; return nullptr;
} else if (first_letter_text_layout_object } else if (first_letter_text_layout_object
......
...@@ -254,7 +254,7 @@ static inline bool CanHaveWhitespaceChildren( ...@@ -254,7 +254,7 @@ static inline bool CanHaveWhitespaceChildren(
const LayoutObject& parent = *context.parent; const LayoutObject& parent = *context.parent;
// <button> and <fieldset> should allow whitespace even though // <button> and <fieldset> should allow whitespace even though
// LayoutFlexibleBox doesn't. // LayoutFlexibleBox doesn't.
if (parent.IsLayoutButton() || parent.IsFieldset()) if (parent.IsButtonOrNGButton() || parent.IsFieldset())
return true; return true;
if (parent.IsTable() || parent.IsTableRow() || parent.IsTableSection() || if (parent.IsTable() || parent.IsTableRow() || parent.IsTableSection() ||
......
...@@ -24,7 +24,7 @@ static bool CanHaveGeneratedChildren(const LayoutObject& layout_object) { ...@@ -24,7 +24,7 @@ static bool CanHaveGeneratedChildren(const LayoutObject& layout_object) {
// Input elements can't have generated children, but button elements can. // 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 // We'll write the code assuming any other button types that might emerge in
// the future can also have children. // the future can also have children.
if (layout_object.IsLayoutButton()) if (layout_object.IsButtonOrNGButton())
return !IsA<HTMLInputElement>(*layout_object.GetNode()); return !IsA<HTMLInputElement>(*layout_object.GetNode());
return layout_object.CanHaveChildren(); return layout_object.CanHaveChildren();
......
...@@ -2238,7 +2238,7 @@ PhysicalRect LayoutBox::OverflowClipRect( ...@@ -2238,7 +2238,7 @@ PhysicalRect LayoutBox::OverflowClipRect(
if (UNLIKELY(input)) { if (UNLIKELY(input)) {
// As for LayoutButton, ControlClip is to for not BUTTONs but INPUT // As for LayoutButton, ControlClip is to for not BUTTONs but INPUT
// buttons for IE/Firefox compatibility. // buttons for IE/Firefox compatibility.
if (IsTextField() || IsLayoutButton()) { if (IsTextField() || IsButtonOrNGButton()) {
DCHECK(HasControlClip()); DCHECK(HasControlClip());
PhysicalRect control_clip = PhysicalPaddingBoxRect(); PhysicalRect control_clip = PhysicalPaddingBoxRect();
control_clip.Move(location); control_clip.Move(location);
...@@ -2258,7 +2258,7 @@ PhysicalRect LayoutBox::OverflowClipRect( ...@@ -2258,7 +2258,7 @@ PhysicalRect LayoutBox::OverflowClipRect(
bool LayoutBox::HasControlClip() const { bool LayoutBox::HasControlClip() const {
return UNLIKELY(IsTextField() || IsFileUploadControl() || IsMenuList(this) || return UNLIKELY(IsTextField() || IsFileUploadControl() || IsMenuList(this) ||
(IsLayoutButton() && IsA<HTMLInputElement>(GetNode()))); (IsButtonOrNGButton() && IsA<HTMLInputElement>(GetNode())));
} }
void LayoutBox::ExcludeScrollbars( void LayoutBox::ExcludeScrollbars(
......
...@@ -716,7 +716,10 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver, ...@@ -716,7 +716,10 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
} }
bool IsProgress() const { return IsOfType(kLayoutObjectProgress); } bool IsProgress() const { return IsOfType(kLayoutObjectProgress); }
bool IsQuote() const { return IsOfType(kLayoutObjectQuote); } 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 IsLayoutNGButton() const { return IsOfType(kLayoutObjectNGButton); }
bool IsLayoutNGCustom() const { bool IsLayoutNGCustom() const {
return IsOfType(kLayoutObjectLayoutNGCustom); return IsOfType(kLayoutObjectLayoutNGCustom);
...@@ -1293,7 +1296,7 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver, ...@@ -1293,7 +1296,7 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
SpannerPlaceholder(); 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 // implemented using flex box but should still support things like
// first-line, first-letter and text-overflow. // first-line, first-letter and text-overflow.
// The flex box and grid specs require that flex box and grid do not // The flex box and grid specs require that flex box and grid do not
...@@ -1304,7 +1307,7 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver, ...@@ -1304,7 +1307,7 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
// instead of flex box. crbug.com/226252. // instead of flex box. crbug.com/226252.
bool BehavesLikeBlockContainer() const { bool BehavesLikeBlockContainer() const {
return (IsLayoutBlockFlow() && StyleRef().IsDisplayBlockContainer()) || return (IsLayoutBlockFlow() && StyleRef().IsDisplayBlockContainer()) ||
IsLayoutButton(); IsButtonOrNGButton();
} }
// May be optionally passed to container() and various other similar methods // 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