Commit 34bc2b61 authored by Koji Ishii's avatar Koji Ishii Committed by Commit Bot

[LayoutNG] Rename InlineBlock sub-type to AtomicInline

This patch rename InlineBlock sub-type of NGPhysicalBoxFragment
to AtomicInline, because it actually includes replaced elements.

NGPhysicalFragment does not provide a function to distinguish
inline block from replaced elements today, and all uses were
replaced in this CL. We might add one if needed.

Bug: 636993
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_layout_ng;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I55362b6956b8ea29853f685961d711fdcb5b6c4a
Reviewed-on: https://chromium-review.googlesource.com/898145
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534055}
parent faf48064
......@@ -139,7 +139,7 @@ CaretPositionResolution TryResolveCaretPositionInTextFragment(
unsigned GetTextOffsetBefore(const NGPhysicalBoxFragment& fragment) {
// TODO(xiaochengh): Design more straightforward way to get text offset of
// atomic inline box.
DCHECK(fragment.IsInlineBlock());
DCHECK(fragment.IsAtomicInline());
const Node* node = fragment.GetNode();
DCHECK(node);
const Position before_node = Position::BeforeNode(*node);
......@@ -196,7 +196,7 @@ CaretPositionResolution TryResolveCaretPositionWithFragment(
ToNGPhysicalTextFragment(fragment), current_line, last_line, offset,
affinity);
}
if (fragment.IsBox() && fragment.IsInlineBlock()) {
if (fragment.IsBox() && fragment.IsAtomicInline()) {
return TryResolveCaretPositionByBoxFragmentSide(
ToNGPhysicalBoxFragment(fragment), current_line, last_line, offset,
affinity);
......
......@@ -31,7 +31,7 @@ NGPhysicalFragment::NGBoxType BoxTypeFromLayoutObject(
if (layout_object->IsOutOfFlowPositioned())
return NGPhysicalFragment::NGBoxType::kOutOfFlowPositioned;
if (layout_object->IsAtomicInlineLevel())
return NGPhysicalFragment::NGBoxType::kInlineBlock;
return NGPhysicalFragment::NGBoxType::kAtomicInline;
if (layout_object->IsInline())
return NGPhysicalFragment::NGBoxType::kInlineBox;
return NGPhysicalFragment::NGBoxType::kNormalBox;
......
......@@ -57,7 +57,7 @@ TEST_F(NGPhysicalBoxFragmentTest, InlineBlockOldLayoutRoot) {
const NGPhysicalFragment* fragment = line_box->Children().front().get();
ASSERT_TRUE(fragment);
EXPECT_TRUE(fragment->IsBox());
EXPECT_EQ(NGPhysicalFragment::kInlineBlock, fragment->BoxType());
EXPECT_EQ(NGPhysicalFragment::kAtomicInline, fragment->BoxType());
EXPECT_TRUE(fragment->IsOldLayoutRoot());
EXPECT_TRUE(fragment->IsBlockLayoutRoot());
}
......
......@@ -49,8 +49,8 @@ String StringForBoxType(const NGPhysicalFragment& fragment) {
case NGPhysicalFragment::NGBoxType::kInlineBox:
result.Append("inline");
break;
case NGPhysicalFragment::NGBoxType::kInlineBlock:
result.Append("inline-block");
case NGPhysicalFragment::NGBoxType::kAtomicInline:
result.Append("atomic-inline");
break;
case NGPhysicalFragment::NGBoxType::kFloating:
result.Append("floating");
......
......@@ -50,7 +50,7 @@ class CORE_EXPORT NGPhysicalFragment
enum NGBoxType {
kNormalBox,
kInlineBox,
kInlineBlock,
kAtomicInline,
kFloating,
kOutOfFlowPositioned,
// When adding new values, make sure the bit size of |box_type_| is large
......@@ -58,7 +58,7 @@ class CORE_EXPORT NGPhysicalFragment
// Also, add after kMinimumBlockLayoutRoot if the box type is a block layout
// root, or before otherwise. See IsBlockLayoutRoot().
kMinimumBlockLayoutRoot = kInlineBlock
kMinimumBlockLayoutRoot = kAtomicInline
};
~NGPhysicalFragment();
......@@ -79,11 +79,13 @@ class CORE_EXPORT NGPhysicalFragment
bool IsInlineBox() const { return BoxType() == NGBoxType::kInlineBox; }
// Returns whether the fragment is old layout root.
bool IsOldLayoutRoot() const { return is_old_layout_root_; }
// An inline block is represented as a kFragmentBox.
// TODO(eae): This isn't true for replaces elements at the moment.
bool IsInlineBlock() const { return BoxType() == NGBoxType::kInlineBlock; }
// An atomic inline is represented as a kFragmentBox, such as inline block and
// replaced elements.
bool IsAtomicInline() const { return BoxType() == NGBoxType::kAtomicInline; }
// True if this fragment is in-flow in an inline formatting context.
bool IsInline() const { return IsText() || IsInlineBox() || IsInlineBlock(); }
bool IsInline() const {
return IsText() || IsInlineBox() || IsAtomicInline();
}
bool IsFloating() const { return BoxType() == NGBoxType::kFloating; }
bool IsOutOfFlowPositioned() const {
return BoxType() == NGBoxType::kOutOfFlowPositioned;
......
......@@ -94,8 +94,8 @@ void NGBoxFragmentPainter::PaintWithAdjustedOffset(
if (!IntersectsPaintRect(info, paint_offset))
return;
if (PhysicalFragment().IsInlineBlock())
return PaintInlineBlock(info, paint_offset);
if (PhysicalFragment().IsAtomicInline())
return PaintAtomicInline(info, paint_offset);
PaintPhase original_phase = info.phase;
......@@ -272,8 +272,8 @@ void NGBoxFragmentPainter::PaintBlockFlowContents(
void NGBoxFragmentPainter::PaintInlineChild(const NGPaintFragment& child,
const PaintInfo& paint_info,
const LayoutPoint& paint_offset) {
// Inline-block children should be painted by PaintInlineBlockChild.
DCHECK(!child.PhysicalFragment().IsInlineBlock());
// Atomic-inline children should be painted by PaintAtomicInlineChild.
DCHECK(!child.PhysicalFragment().IsAtomicInline());
const NGPhysicalFragment& fragment = child.PhysicalFragment();
PaintInfo descendants_info = paint_info.ForDescendants();
......@@ -541,9 +541,9 @@ void NGBoxFragmentPainter::PaintInlineChildren(
for (const auto& child : inline_children) {
if (child->PhysicalFragment().IsFloating())
continue;
if (child->PhysicalFragment().IsInlineBlock())
PaintInlineBlockChild(*child, paint_info, paint_offset,
legacy_paint_offset);
if (child->PhysicalFragment().IsAtomicInline())
PaintAtomicInlineChild(*child, paint_info, paint_offset,
legacy_paint_offset);
else
PaintInlineChild(*child, paint_info, paint_offset);
}
......@@ -556,13 +556,13 @@ void NGBoxFragmentPainter::PaintInlineChildrenOutlines(
// TODO(layout-dev): Implement.
}
void NGBoxFragmentPainter::PaintInlineBlockChild(
void NGBoxFragmentPainter::PaintAtomicInlineChild(
const NGPaintFragment& child,
const PaintInfo& paint_info,
const LayoutPoint& paint_offset,
const LayoutPoint& legacy_paint_offset) {
// Inline children should be painted by PaintInlineChild.
DCHECK(child.PhysicalFragment().IsInlineBlock());
DCHECK(child.PhysicalFragment().IsAtomicInline());
const NGPhysicalFragment& fragment = child.PhysicalFragment();
if (child.HasSelfPaintingLayer())
......@@ -580,8 +580,8 @@ void NGBoxFragmentPainter::PaintInlineBlockChild(
void NGBoxFragmentPainter::PaintTextChild(const NGPaintFragment& text_fragment,
const PaintInfo& paint_info,
const LayoutPoint& paint_offset) {
// Inline blocks should be painted by PaintInlineBlockChild.
DCHECK(!text_fragment.PhysicalFragment().IsInlineBlock());
// Inline blocks should be painted by PaintAtomicInlineChild.
DCHECK(!text_fragment.PhysicalFragment().IsAtomicInline());
if (DrawingRecorder::UseCachedDrawingIfPossible(
paint_info.context, text_fragment,
DisplayItem::PaintPhaseToDrawingType(paint_info.phase))) {
......@@ -596,8 +596,8 @@ void NGBoxFragmentPainter::PaintTextChild(const NGPaintFragment& text_fragment,
text_painter.Paint(paint_info, paint_offset);
}
void NGBoxFragmentPainter::PaintInlineBlock(const PaintInfo& paint_info,
const LayoutPoint& paint_offset) {
void NGBoxFragmentPainter::PaintAtomicInline(const PaintInfo& paint_info,
const LayoutPoint& paint_offset) {
if (paint_info.phase != PaintPhase::kForeground &&
paint_info.phase != PaintPhase::kSelection)
return;
......
......@@ -88,10 +88,10 @@ class NGBoxFragmentPainter : public BoxPainterBase {
void PaintInlineChild(const NGPaintFragment&,
const PaintInfo&,
const LayoutPoint& paint_offset);
void PaintInlineBlockChild(const NGPaintFragment&,
const PaintInfo&,
const LayoutPoint& paint_offset,
const LayoutPoint& legacy_paint_offset);
void PaintAtomicInlineChild(const NGPaintFragment&,
const PaintInfo&,
const LayoutPoint& paint_offset,
const LayoutPoint& legacy_paint_offset);
void PaintTextChild(const NGPaintFragment&,
const PaintInfo&,
const LayoutPoint& paint_offset);
......@@ -102,7 +102,7 @@ class NGBoxFragmentPainter : public BoxPainterBase {
void PaintMask(const PaintInfo&, const LayoutPoint&);
void PaintClippingMask(const PaintInfo&, const LayoutPoint&);
void PaintOverflowControlsIfNeeded(const PaintInfo&, const LayoutPoint&);
void PaintInlineBlock(const PaintInfo&, const LayoutPoint& paint_offset);
void PaintAtomicInline(const PaintInfo&, const LayoutPoint& paint_offset);
void PaintBackground(const PaintInfo&,
const LayoutRect&,
const Color& background_color,
......
......@@ -65,7 +65,7 @@ children with outlines.
NGPaintFragmentTraversal::DescendantsOf(paint_fragment_)) {
const ComputedStyle& descendant_style = paint_descendant.fragment->Style();
if (!paint_descendant.fragment->PhysicalFragment().IsBox() ||
paint_descendant.fragment->PhysicalFragment().IsInlineBlock())
paint_descendant.fragment->PhysicalFragment().IsAtomicInline())
continue;
if (!descendant_style.HasOutline() ||
......
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