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